# HG changeset patch # User Martin von Zweigbergk # Date 2019-12-13 22:49:48 # Node ID daed70e95d604980d295e4b38b59a5cc8b5ab542 # Parent 7929bb58146fa9b8ae6239d6c1d6284d6ce745fe 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 diff --git a/hgext/rebase.py b/hgext/rebase.py --- a/hgext/rebase.py +++ b/hgext/rebase.py @@ -1026,8 +1026,7 @@ def rebase(ui, repo, **opts): 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. diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -268,6 +268,7 @@ def check_at_most_one_arg(opts, *args): 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)