rebase: use cmdutil.check_at_most_one_arg() for --confirm/--dry-run
authorMartin von Zweigbergk <martinvonz@google.com>
Fri, 13 Dec 2019 14:49:48 -0800
changeset 43926 daed70e95d60
parent 43925 7929bb58146f
child 43927 905b21783968
rebase: use cmdutil.check_at_most_one_arg() for --confirm/--dry-run I've also updated the helper to work with the hyphenated --dry-run option. Differential Revision: https://phab.mercurial-scm.org/D7641
hgext/rebase.py
mercurial/cmdutil.py
--- a/hgext/rebase.py	Tue Dec 17 21:25:54 2019 -0500
+++ b/hgext/rebase.py	Fri Dec 13 14:49:48 2019 -0800
@@ -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_at_most_one_arg(opts, b'confirm', b'dry_run')
 
     if action or repo.currenttransaction() is not None:
         # in-memory rebase is not compatible with resuming rebases.
--- a/mercurial/cmdutil.py	Tue Dec 17 21:25:54 2019 -0500
+++ b/mercurial/cmdutil.py	Fri Dec 13 14:49:48 2019 -0800
@@ -268,6 +268,7 @@
     previous = None
     for x in args:
         if opts.get(x):
+            x = x.replace(b'_', b'-')
             if previous:
                 raise error.Abort(
                     _(b'cannot specify both --%s and --%s') % (previous, x)