D7641: rebase: use cmdutil.check_unique_argument() for --confirm/--dry-run
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Fri Dec 13 07:56:23 UTC 2019
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
I've also updated the helper to work with the hyphenated --dry-run
option.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D7641
AFFECTED FILES
hgext/rebase.py
mercurial/cmdutil.py
CHANGE DETAILS
diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -267,7 +267,7 @@
"""
previous = None
for x in args:
- if opts.get(x):
+ if opts.get(x.replace(b'-', b'_')):
if previous:
raise error.Abort(
_(b'cannot specify both --%s and --%s') % (previous, x)
diff --git a/hgext/rebase.py b/hgext/rebase.py
--- a/hgext/rebase.py
+++ b/hgext/rebase.py
@@ -1022,12 +1022,9 @@
dryrun = opts.get(b'dry_run')
confirm = opts.get(b'confirm')
action = cmdutil.check_unique_argument(opts, b'abort', b'stop', b'continue')
- if dryrun and action:
- raise error.Abort(_(b'cannot specify both --dry-run and --%s') % action)
- if confirm and action:
- raise error.Abort(_(b'cannot specify both --confirm and --%s') % action)
- if dryrun and confirm:
- raise error.Abort(_(b'cannot specify both --confirm and --dry-run'))
+ if action:
+ cmdutil.check_unique_argument(opts, b'confirm', b'dry-run', action)
+ cmdutil.check_unique_argument(opts, b'confirm', b'dry-run')
if action or repo.currenttransaction() is not None:
# in-memory rebase is not compatible with resuming rebases.
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list