mercurial/cmdutil.py
changeset 43892 d587937600be
parent 43861 aac921f54554
child 43893 2e672ccc2220
--- 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