Patchwork D7641: rebase: use cmdutil.check_unique_argument() for --confirm/--dry-run

login
register
mail settings
Submitter phabricator
Date Dec. 13, 2019, 10:57 p.m.
Message ID <4ea47eefa9a54350cf866a3a3ecc46d6@localhost.localdomain>
Download mbox | patch
Permalink /patch/43820/
State Not Applicable
Headers show

Comments

phabricator - Dec. 13, 2019, 10:57 p.m.
martinvonz updated this revision to Diff 18710.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7641?vs=18676&id=18710

BRANCH
  default

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7641/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7641

AFFECTED FILES
  hgext/rebase.py
  mercurial/cmdutil.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

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
@@ -1026,8 +1026,7 @@ 
         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'))
+    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.