Debian Codegraph @

hgext/strip.py

raw
1 """strip changesets and their descendants from history (DEPRECATED)
2
3 The functionality of this extension has been included in core Mercurial
4 since version 5.7. Please use :hg:`debugstrip ...` instead.
5
6 This extension allows you to strip changesets and all their descendants from the
7 repository. See the command help for details.
8 """
9
10 from __future__ import annotations
11
12 from mercurial.i18n import _
13
14 from mercurial import (
15 registrar,
16 strip,
17 )
18
19 cmdtable = {}
20 command = registrar.command(cmdtable)
21
22 # Note for extension authors: ONLY specify testedwith = 'ships-with-hg-core' for
23 # extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
24 # be specifying the version(s) of Mercurial they are tested with, or
25 # leave the attribute unspecified.
26 testedwith = b'ships-with-hg-core'
27
28
29 @command(
30 b"strip",
31 [
32 (
33 b'r',
34 b'rev',
35 [],
36 _(
37 b'strip specified revision (optional, '
38 b'can specify revisions without this '
39 b'option)'
40 ),
41 _(b'REV'),
42 ),
43 (
44 b'f',
45 b'force',
46 None,
47 _(
48 b'force removal of changesets, discard '
49 b'uncommitted changes (no backup)'
50 ),
51 ),
52 (b'', b'no-backup', None, _(b'do not save backup bundle')),
53 (
54 b'',
55 b'nobackup',
56 None,
57 _(b'do not save backup bundle (DEPRECATED)'),
58 ),
59 (b'n', b'', None, _(b'ignored (DEPRECATED)')),
60 (
61 b'k',
62 b'keep',
63 None,
64 _(b"do not modify working directory during strip"),
65 ),
66 (
67 b'B',
68 b'bookmark',
69 [],
70 _(b"remove revs only reachable from given bookmark"),
71 _(b'BOOKMARK'),
72 ),
73 (
74 b'',
75 b'soft',
76 None,
77 _(b"simply drop changesets from visible history (EXPERIMENTAL)"),
78 ),
79 (
80 b'',
81 b'permit-empty-revset',
82 False,
83 _(b"return success even if no revision was stripped"),
84 ),
85 ],
86 _(b'hg strip [-k] [-f] [-B bookmark] [-r] REV...'),
87 helpcategory=command.CATEGORY_MAINTENANCE,
88 )
89 def _strip(ui, repo, *revs, **opts):
90 return strip._strip_command(ui, repo, *revs, **opts)