changeset 45739:693da1b928af

backout: leverage cmdutil.check_incompatible_arguments() Differential Revision: https://phab.mercurial-scm.org/D9216
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 15 Oct 2020 21:44:03 -0700
parents 5df1655edf42
children d1cabce5ef05
files mercurial/commands.py tests/test-backout.t
diffstat 2 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Oct 12 12:52:45 2020 -0700
+++ b/mercurial/commands.py	Thu Oct 15 21:44:03 2020 -0700
@@ -769,11 +769,8 @@
 
 
 def _dobackout(ui, repo, node=None, rev=None, **opts):
+    cmdutil.check_incompatible_arguments(opts, 'no_commit', ['commit', 'merge'])
     opts = pycompat.byteskwargs(opts)
-    if opts.get(b'commit') and opts.get(b'no_commit'):
-        raise error.Abort(_(b"cannot use --commit with --no-commit"))
-    if opts.get(b'merge') and opts.get(b'no_commit'):
-        raise error.Abort(_(b"cannot use --merge with --no-commit"))
 
     if rev and node:
         raise error.Abort(_(b"please specify just one revision"))
--- a/tests/test-backout.t	Mon Oct 12 12:52:45 2020 -0700
+++ b/tests/test-backout.t	Thu Oct 15 21:44:03 2020 -0700
@@ -804,5 +804,5 @@
 --no-commit can't be used with --merge
 
   $ hg backout --merge --no-commit 2
-  abort: cannot use --merge with --no-commit
+  abort: cannot specify both --no-commit and --merge
   [255]