annotate hgext3rd/topic/compat.py @ 6858:37844623df8c stable

tests: accommodate both "hg-evolve" and "hg_evolve" in tarballs Looks like current distutils (or maybe setuptools, I'm not an expert) that are available in Debian Testing create tarballs that have an underscore instead of a hyphen in the name. The paths inside the tarball are also different, so we need to change the sed instruction too.
author Anton Shestakov <av6@dwimlabs.net>
date Mon, 09 Sep 2024 18:19:36 +0400
parents 4c6d35f92469
children 71c4b6c2bcdc
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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)
6697
4c6d35f92469 topic: handle commitstatus() with opts=None for hg <= 6.5 too
Zeger Van de Vannet <zeger@vandevan.net>
parents: 6571
diff changeset
62 if opts is None:
4c6d35f92469 topic: handle commitstatus() with opts=None for hg <= 6.5 too
Zeger Van de Vannet <zeger@vandevan.net>
parents: 6571
diff changeset
63 opts = {}
6547
d13cfd9eb6c0 topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents: 6333
diff changeset
64 opts = pycompat.strkwargs(opts)
6569
9a55b007faf6 compat: make sure to actually pass tip to commitstatus()
Anton Shestakov <av6@dwimlabs.net>
parents: 6547
diff changeset
65 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
66 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
67 else:
dd9dba7c1d00 compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents: 5426
diff changeset
68 # hg <= 5.6 (976b26bdd0d8)
dd9dba7c1d00 compat: make topics compatible across change to cmdutil.commitstatus()
Martin von Zweigbergk <martinvonz@google.com>
parents: 5426
diff changeset
69 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
70 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
71 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
72 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
73 if opts is None:
d13cfd9eb6c0 topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents: 6333
diff changeset
74 opts = {}
d13cfd9eb6c0 topic: compatibility for commitstatus(..., **opts)
Anton Shestakov <av6@dwimlabs.net>
parents: 6333
diff changeset
75 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
76 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
77 extensions.wrapfunction(cmdutil, 'commitstatus', _override)
6318
3e488afe62f5 topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents: 6305
diff changeset
78
3e488afe62f5 topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents: 6305
diff changeset
79 if util.safehasattr(error, 'InputError'):
3e488afe62f5 topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents: 6305
diff changeset
80 InputError = error.InputError
3e488afe62f5 topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents: 6305
diff changeset
81 else:
3e488afe62f5 topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents: 6305
diff changeset
82 # hg <= 5.6 (8d72e29ad1e0)
3e488afe62f5 topic: use compat.InputError for conflicting CLI flags
Anton Shestakov <av6@dwimlabs.net>
parents: 6305
diff changeset
83 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
84
6321
58b856416d2e topic: use compat.StateError for aborting pushes that create new heads
Anton Shestakov <av6@dwimlabs.net>
parents: 6320
diff changeset
85 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
86 StateError = error.StateError
58b856416d2e topic: use compat.StateError for aborting pushes that create new heads
Anton Shestakov <av6@dwimlabs.net>
parents: 6320
diff changeset
87 else:
58b856416d2e topic: use compat.StateError for aborting pushes that create new heads
Anton Shestakov <av6@dwimlabs.net>
parents: 6320
diff changeset
88 # 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
89 StateError = error.Abort
58b856416d2e topic: use compat.StateError for aborting pushes that create new heads
Anton Shestakov <av6@dwimlabs.net>
parents: 6320
diff changeset
90
6322
57f9cdbf6a99 topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents: 6321
diff changeset
91 if util.safehasattr(error, 'CanceledError'):
57f9cdbf6a99 topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents: 6321
diff changeset
92 CanceledError = error.CanceledError
57f9cdbf6a99 topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents: 6321
diff changeset
93 else:
57f9cdbf6a99 topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents: 6321
diff changeset
94 # hg <= 5.6 (ac362d5a7893)
57f9cdbf6a99 topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents: 6321
diff changeset
95 CanceledError = error.Abort
57f9cdbf6a99 topic: use compat.CanceledError for user quit situations
Anton Shestakov <av6@dwimlabs.net>
parents: 6321
diff changeset
96
6320
0c780d972350 topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents: 6318
diff changeset
97 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
98 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
99 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
100 else:
0c780d972350 topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents: 6318
diff changeset
101 # 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
102 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
103 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
104 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
105
0c780d972350 topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents: 6318
diff changeset
106 previous = None
0c780d972350 topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents: 6318
diff changeset
107 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
108 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
109 if previous:
0c780d972350 topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents: 6318
diff changeset
110 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
111 % (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
112 previous = x
0c780d972350 topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents: 6318
diff changeset
113 return previous
0c780d972350 topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents: 6318
diff changeset
114
0c780d972350 topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents: 6318
diff changeset
115 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
116 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
117 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
118 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
119 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
120 else:
0c780d972350 topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents: 6318
diff changeset
121 # 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
122 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
123 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
124 else:
0c780d972350 topic: use check_incompatible_arguments() for --list with --clear or --rev
Anton Shestakov <av6@dwimlabs.net>
parents: 6318
diff changeset
125 # 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
126 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
127 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
128 check_at_most_one_arg(opts, first, other)