[Updated] D8510: diff: use cmdutil.check_at_most_one_arg() for checking --rev/--change
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Mon May 11 21:19:57 UTC 2020
Closed by commit rHGaac816f584ad: diff: use cmdutil.check_at_most_one_arg() for checking --rev/--change (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D8510?vs=21327&id=21337
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D8510/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D8510
AFFECTED FILES
hgext/extdiff.py
mercurial/commands.py
CHANGE DETAILS
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2475,16 +2475,14 @@
Returns 0 on success.
"""
+ cmdutil.check_at_most_one_arg(opts, 'rev', 'change')
opts = pycompat.byteskwargs(opts)
revs = opts.get(b'rev')
change = opts.get(b'change')
stat = opts.get(b'stat')
reverse = opts.get(b'reverse')
- if revs and change:
- msg = _(b'cannot specify --rev and --change at the same time')
- raise error.Abort(msg)
- elif change:
+ if change:
repo = scmutil.unhidehashlikerevs(repo, [change], b'nowarn')
ctx2 = scmutil.revsingle(repo, change, None)
ctx1 = ctx2.p1()
diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -360,14 +360,12 @@
- just invoke the diff for a single file in the working dir
'''
+ cmdutil.check_at_most_one_arg(opts, b'rev', b'change')
revs = opts.get(b'rev')
change = opts.get(b'change')
do3way = b'$parent2' in cmdline
- if revs and change:
- msg = _(b'cannot specify --rev and --change at the same time')
- raise error.Abort(msg)
- elif change:
+ if change:
ctx2 = scmutil.revsingle(repo, change, None)
ctx1a, ctx1b = ctx2.p1(), ctx2.p2()
else:
To: martinvonz, #hg-reviewers
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200511/43ce4497/attachment-0002.html>
More information about the Mercurial-patches
mailing list