Mercurial > public > mercurial-scm > hg-stable
diff mercurial/cmdutil.py @ 43905:fff21278554b
rebase: use cmdutil.check_at_most_one_arg() for action
Here we also needed to know what the action was (if any), so I've
updated the helper to return any specified option.
Differential Revision: https://phab.mercurial-scm.org/D7640
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 12 Dec 2019 15:55:33 -0800 |
parents | 023ad45e2fd2 |
children | daed70e95d60 |
line wrap: on
line diff
--- a/mercurial/cmdutil.py Thu Dec 12 22:30:59 2019 -0800 +++ b/mercurial/cmdutil.py Thu Dec 12 15:55:33 2019 -0800 @@ -261,7 +261,10 @@ def check_at_most_one_arg(opts, *args): - """abort if more than one of the arguments are in opts""" + """abort if more than one of the arguments are in opts + + Returns the unique argument or None if none of them were specified. + """ previous = None for x in args: if opts.get(x): @@ -270,6 +273,7 @@ _(b'cannot specify both --%s and --%s') % (previous, x) ) previous = x + return previous def check_incompatible_arguments(opts, first, *others):