Mercurial > evolve
annotate hgext3rd/topic/compat.py @ 6571:40875ca5e724
compat: older hg versions need byteskwargs in commitstatus()
Notice how we first convert opts to strkwargs, and in this patch we add code to
reverse that operation. Yeah. This is now officially the worst compat code.
author | Anton Shestakov <av6@dwimlabs.net> |
---|---|
date | Thu, 12 Oct 2023 14:37:31 -0300 |
parents | 5b23394b03aa |
children | 4c6d35f92469 |
rev | line source |
---|---|
2922
66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
1 # Copyright 2017 FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
2 # |
66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
3 # This software may be used and distributed according to the terms of the |
66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
4 # GNU General Public License version 2 or any later version. |
66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
5 """ |
66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
6 Compatibility module |
66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
7 """ |
66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
8 from __future__ import absolute_import |
66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
9 |
6320
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
10 from mercurial.i18n import _ |
3094
e11e018e8338
compat: add an abstraction for 'scmutil.cleanupnodes'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3064
diff
changeset
|
11 from mercurial import ( |
5665
dd9dba7c1d00
compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents:
5426
diff
changeset
|
12 cmdutil, |
6318
3e488afe62f5
topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents:
6305
diff
changeset
|
13 error, |
5665
dd9dba7c1d00
compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents:
5426
diff
changeset
|
14 extensions, |
4743
92e3db149d7d
py3: call branchmap.items() on py3 and continue to call iteritems() on py2
Martin von Zweigbergk <martinvonz@google.com>
parents:
3701
diff
changeset
|
15 pycompat, |
4957
e8302f760a54
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4810
diff
changeset
|
16 util, |
3094
e11e018e8338
compat: add an abstraction for 'scmutil.cleanupnodes'
Pierre-Yves David <pierre-yves.david@octobus.net>
parents:
3064
diff
changeset
|
17 ) |
2922
66357d4d03b2
topic: centralize compatibility logic between hg versions into compat module
FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
parents:
diff
changeset
|
18 |
4743
92e3db149d7d
py3: call branchmap.items() on py3 and continue to call iteritems() on py2
Martin von Zweigbergk <martinvonz@google.com>
parents:
3701
diff
changeset
|
19 if pycompat.ispy3: |
92e3db149d7d
py3: call branchmap.items() on py3 and continue to call iteritems() on py2
Martin von Zweigbergk <martinvonz@google.com>
parents:
3701
diff
changeset
|
20 def branchmapitems(branchmap): |
92e3db149d7d
py3: call branchmap.items() on py3 and continue to call iteritems() on py2
Martin von Zweigbergk <martinvonz@google.com>
parents:
3701
diff
changeset
|
21 return branchmap.items() |
92e3db149d7d
py3: call branchmap.items() on py3 and continue to call iteritems() on py2
Martin von Zweigbergk <martinvonz@google.com>
parents:
3701
diff
changeset
|
22 else: |
4810
03690f8d2b0a
python3: add ignore block around python 2 compatibility if branch
Raphaël Gomès <rgomes@octobus.net>
parents:
4743
diff
changeset
|
23 # py3-transform: off |
4743
92e3db149d7d
py3: call branchmap.items() on py3 and continue to call iteritems() on py2
Martin von Zweigbergk <martinvonz@google.com>
parents:
3701
diff
changeset
|
24 def branchmapitems(branchmap): |
92e3db149d7d
py3: call branchmap.items() on py3 and continue to call iteritems() on py2
Martin von Zweigbergk <martinvonz@google.com>
parents:
3701
diff
changeset
|
25 return branchmap.iteritems() |
4810
03690f8d2b0a
python3: add ignore block around python 2 compatibility if branch
Raphaël Gomès <rgomes@octobus.net>
parents:
4743
diff
changeset
|
26 # py3-transform: on |
4957
e8302f760a54
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4810
diff
changeset
|
27 |
6333
f4ffe1e67a9b
topic: move compatibility for branchcache._entries to topic/compat.py
Anton Shestakov <av6@dwimlabs.net>
parents:
6322
diff
changeset
|
28 def bcentries(branchcache): |
f4ffe1e67a9b
topic: move compatibility for branchcache._entries to topic/compat.py
Anton Shestakov <av6@dwimlabs.net>
parents:
6322
diff
changeset
|
29 if util.safehasattr(branchcache, '_entries'): |
f4ffe1e67a9b
topic: move compatibility for branchcache._entries to topic/compat.py
Anton Shestakov <av6@dwimlabs.net>
parents:
6322
diff
changeset
|
30 return branchcache._entries |
f4ffe1e67a9b
topic: move compatibility for branchcache._entries to topic/compat.py
Anton Shestakov <av6@dwimlabs.net>
parents:
6322
diff
changeset
|
31 else: |
f4ffe1e67a9b
topic: move compatibility for branchcache._entries to topic/compat.py
Anton Shestakov <av6@dwimlabs.net>
parents:
6322
diff
changeset
|
32 # hg <= 4.9 (624d6683c705+b137a6793c51) |
f4ffe1e67a9b
topic: move compatibility for branchcache._entries to topic/compat.py
Anton Shestakov <av6@dwimlabs.net>
parents:
6322
diff
changeset
|
33 return branchcache |
f4ffe1e67a9b
topic: move compatibility for branchcache._entries to topic/compat.py
Anton Shestakov <av6@dwimlabs.net>
parents:
6322
diff
changeset
|
34 |
4957
e8302f760a54
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4810
diff
changeset
|
35 # nodemap.get and index.[has_node|rev|get_rev] |
5193
a4d081923c81
compat: update hg-X.Y compat comments and test them
Anton Shestakov <av6@dwimlabs.net>
parents:
4963
diff
changeset
|
36 # hg <= 5.2 (02802fa87b74) |
4957
e8302f760a54
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4810
diff
changeset
|
37 def getgetrev(cl): |
e8302f760a54
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4810
diff
changeset
|
38 """Returns index.get_rev or nodemap.get (for pre-5.3 Mercurial).""" |
e8302f760a54
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4810
diff
changeset
|
39 if util.safehasattr(cl.index, 'get_rev'): |
e8302f760a54
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4810
diff
changeset
|
40 return cl.index.get_rev |
e8302f760a54
compat: compatibility for cl.nodemap.get vs cl.index.get_rev
Anton Shestakov <av6@dwimlabs.net>
parents:
4810
diff
changeset
|
41 return cl.nodemap.get |
5426
86736040b0ec
topic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
42 |
86736040b0ec
topic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
43 # hg <= 5.4 (e2d17974a869) |
86736040b0ec
topic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
44 def nonpublicphaseroots(repo): |
86736040b0ec
topic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
45 if util.safehasattr(repo._phasecache, 'nonpublicphaseroots'): |
86736040b0ec
topic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
46 return repo._phasecache.nonpublicphaseroots(repo) |
86736040b0ec
topic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
47 return set().union( |
86736040b0ec
topic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
48 *[roots for roots in repo._phasecache.phaseroots[1:] if roots] |
86736040b0ec
topic: compatibility with sparse phaseroots and phasesets in 5.5
Joerg Sonnenberger <joerg@bec.de>
parents:
5193
diff
changeset
|
49 ) |
5665
dd9dba7c1d00
compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents:
5426
diff
changeset
|
50 |
dd9dba7c1d00
compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents:
5426
diff
changeset
|
51 def overridecommitstatus(overridefn): |
6547
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
52 code = cmdutil.commitstatus.__code__ |
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
53 if r'opts' in code.co_varnames[code.co_argcount:]: |
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
54 # commitstatus(..., **opts) |
5665
dd9dba7c1d00
compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents:
5426
diff
changeset
|
55 extensions.wrapfunction(cmdutil, 'commitstatus', overridefn) |
6547
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
56 elif r'tip' in code.co_varnames: |
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
57 # hg <= 6.5 (489268c8ee7e) |
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
58 def _override(orig, repo, node, branch, bheads=None, tip=None, opts=None): |
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
59 def _orig(repo, node, branch, bheads=None, tip=None, **opts): |
6571
40875ca5e724
compat: older hg versions need byteskwargs in commitstatus()
Anton Shestakov <av6@dwimlabs.net>
parents:
6570
diff
changeset
|
60 opts = pycompat.byteskwargs(opts) |
6569
9a55b007faf6
compat: make sure to actually pass tip to commitstatus()
Anton Shestakov <av6@dwimlabs.net>
parents:
6547
diff
changeset
|
61 return orig(repo, node, branch, bheads=bheads, tip=tip, opts=opts) |
6547
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
62 opts = pycompat.strkwargs(opts) |
6569
9a55b007faf6
compat: make sure to actually pass tip to commitstatus()
Anton Shestakov <av6@dwimlabs.net>
parents:
6547
diff
changeset
|
63 return overridefn(_orig, repo, node, branch, bheads=bheads, tip=tip, **opts) |
6547
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
64 extensions.wrapfunction(cmdutil, 'commitstatus', _override) |
5665
dd9dba7c1d00
compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents:
5426
diff
changeset
|
65 else: |
dd9dba7c1d00
compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents:
5426
diff
changeset
|
66 # hg <= 5.6 (976b26bdd0d8) |
dd9dba7c1d00
compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents:
5426
diff
changeset
|
67 def _override(orig, repo, node, branch, bheads=None, opts=None): |
6570
5b23394b03aa
compat: hg 5.6 doesn't have tip as an argument to commitstatus() at all
Anton Shestakov <av6@dwimlabs.net>
parents:
6569
diff
changeset
|
68 def _orig(repo, node, branch, bheads=None, **opts): |
6571
40875ca5e724
compat: older hg versions need byteskwargs in commitstatus()
Anton Shestakov <av6@dwimlabs.net>
parents:
6570
diff
changeset
|
69 opts = pycompat.byteskwargs(opts) |
5665
dd9dba7c1d00
compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents:
5426
diff
changeset
|
70 return orig(repo, node, branch, bheads=bheads, opts=opts) |
6547
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
71 if opts is None: |
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
72 opts = {} |
d13cfd9eb6c0
topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents:
6333
diff
changeset
|
73 opts = pycompat.strkwargs(opts) |
6570
5b23394b03aa
compat: hg 5.6 doesn't have tip as an argument to commitstatus() at all
Anton Shestakov <av6@dwimlabs.net>
parents:
6569
diff
changeset
|
74 return overridefn(_orig, repo, node, branch, bheads=bheads, **opts) |
5665
dd9dba7c1d00
compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents:
5426
diff
changeset
|
75 extensions.wrapfunction(cmdutil, 'commitstatus', _override) |
6318
3e488afe62f5
topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents:
6305
diff
changeset
|
76 |
3e488afe62f5
topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents:
6305
diff
changeset
|
77 if util.safehasattr(error, 'InputError'): |
3e488afe62f5
topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents:
6305
diff
changeset
|
78 InputError = error.InputError |
3e488afe62f5
topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents:
6305
diff
changeset
|
79 else: |
3e488afe62f5
topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents:
6305
diff
changeset
|
80 # hg <= 5.6 (8d72e29ad1e0) |
3e488afe62f5
topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents:
6305
diff
changeset
|
81 InputError = error.Abort |
6320
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
82 |
6321
58b856416d2e
topic: use compat.StateError for aborting pushes that create new heads
Anton Shestakov <av6@dwimlabs.net>
parents:
6320
diff
changeset
|
83 if util.safehasattr(error, 'StateError'): |
58b856416d2e
topic: use compat.StateError for aborting pushes that create new heads
Anton Shestakov <av6@dwimlabs.net>
parents:
6320
diff
changeset
|
84 StateError = error.StateError |
58b856416d2e
topic: use compat.StateError for aborting pushes that create new heads
Anton Shestakov <av6@dwimlabs.net>
parents:
6320
diff
changeset
|
85 else: |
58b856416d2e
topic: use compat.StateError for aborting pushes that create new heads
Anton Shestakov <av6@dwimlabs.net>
parents:
6320
diff
changeset
|
86 # hg <= 5.6 (527ce85c2e60) |
58b856416d2e
topic: use compat.StateError for aborting pushes that create new heads
Anton Shestakov <av6@dwimlabs.net>
parents:
6320
diff
changeset
|
87 StateError = error.Abort |
58b856416d2e
topic: use compat.StateError for aborting pushes that create new heads
Anton Shestakov <av6@dwimlabs.net>
parents:
6320
diff
changeset
|
88 |
6322
57f9cdbf6a99
topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents:
6321
diff
changeset
|
89 if util.safehasattr(error, 'CanceledError'): |
57f9cdbf6a99
topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents:
6321
diff
changeset
|
90 CanceledError = error.CanceledError |
57f9cdbf6a99
topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents:
6321
diff
changeset
|
91 else: |
57f9cdbf6a99
topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents:
6321
diff
changeset
|
92 # hg <= 5.6 (ac362d5a7893) |
57f9cdbf6a99
topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents:
6321
diff
changeset
|
93 CanceledError = error.Abort |
57f9cdbf6a99
topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents:
6321
diff
changeset
|
94 |
6320
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
95 if util.safehasattr(cmdutil, 'check_at_most_one_arg'): |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
96 def check_at_most_one_arg(opts, *args): |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
97 return cmdutil.check_at_most_one_arg(opts, *args) |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
98 else: |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
99 # hg <= 5.2 (d587937600be) |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
100 def check_at_most_one_arg(opts, *args): |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
101 def to_display(name): |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
102 return pycompat.sysbytes(name).replace(b'_', b'-') |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
103 |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
104 previous = None |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
105 for x in args: |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
106 if opts.get(x): |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
107 if previous: |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
108 raise InputError(_(b'cannot specify both --%s and --%s') |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
109 % (to_display(previous), to_display(x))) |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
110 previous = x |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
111 return previous |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
112 |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
113 if util.safehasattr(cmdutil, 'check_incompatible_arguments'): |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
114 code = cmdutil.check_incompatible_arguments.__code__ |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
115 if r'others' in code.co_varnames[:code.co_argcount]: |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
116 def check_incompatible_arguments(opts, first, others): |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
117 return cmdutil.check_incompatible_arguments(opts, first, others) |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
118 else: |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
119 # hg <= 5.3 (d4c1501225c4) |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
120 def check_incompatible_arguments(opts, first, others): |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
121 return cmdutil.check_incompatible_arguments(opts, first, *others) |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
122 else: |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
123 # hg <= 5.2 (023ad45e2fd2) |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
124 def check_incompatible_arguments(opts, first, others): |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
125 for other in others: |
0c780d972350
topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents:
6318
diff
changeset
|
126 check_at_most_one_arg(opts, first, other) |