changeset 43926:daed70e95d60

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
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 13 Dec 2019 14:49:48 -0800
parents 7929bb58146f
children 905b21783968
files hgext/rebase.py mercurial/cmdutil.py
diffstat 2 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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)