diff -r 7eb6a2680ae6 -r d587937600be mercurial/cmdutil.py --- a/mercurial/cmdutil.py Fri Dec 13 14:40:52 2019 -0800 +++ b/mercurial/cmdutil.py Thu Dec 12 15:16:13 2019 -0800 @@ -260,6 +260,18 @@ _linebelow = b"^HG: ------------------------ >8 ------------------------$" +def check_at_most_one_arg(opts, *args): + """abort if more than one of the arguments are in opts""" + previous = None + for x in args: + if opts.get(x): + if previous: + raise error.Abort( + _(b'cannot specify both --%s and --%s') % (previous, x) + ) + previous = x + + def resolvecommitoptions(ui, opts): """modify commit options dict to handle related options