changeset 44174:75c2ca094d3a

merge: use check_incompatible_arguments() for --abort Differential Revision: https://phab.mercurial-scm.org/D7993
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 24 Jan 2020 15:07:44 -0800
parents 1cb7ae9b0071
children 2b6632d64328
files mercurial/commands.py tests/test-commit-unresolved.t
diffstat 2 files changed, 3 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Wed Jan 15 17:15:45 2020 -0800
+++ b/mercurial/commands.py	Fri Jan 24 15:07:44 2020 -0800
@@ -4847,6 +4847,7 @@
     abort = opts.get(b'abort')
     if abort and repo.dirstate.p2() == nullid:
         cmdutil.wrongtooltocontinue(repo, _(b'merge'))
+    cmdutil.check_incompatible_arguments(opts, b'abort', b'rev', b'preview')
     if abort:
         state = cmdutil.getunfinishedstate(repo)
         if state and state._opname != b'merge':
@@ -4856,10 +4857,6 @@
             )
         if node:
             raise error.Abort(_(b"cannot specify a node with --abort"))
-        if opts.get(b'rev'):
-            raise error.Abort(_(b"cannot specify both --rev and --abort"))
-        if opts.get(b'preview'):
-            raise error.Abort(_(b"cannot specify --preview with --abort"))
     if opts.get(b'rev') and node:
         raise error.Abort(_(b"please specify just one revision"))
     if not node:
--- a/tests/test-commit-unresolved.t	Wed Jan 15 17:15:45 2020 -0800
+++ b/tests/test-commit-unresolved.t	Fri Jan 24 15:07:44 2020 -0800
@@ -60,7 +60,7 @@
   abort: cannot specify a node with --abort
   [255]
   $ hg merge --abort --rev e4501
-  abort: cannot specify both --rev and --abort
+  abort: cannot specify both --abort and --rev
   [255]
 
 #if abortcommand
@@ -144,7 +144,7 @@
   (branch merge, don't forget to commit)
 
   $ hg merge --preview --abort
-  abort: cannot specify --preview with --abort
+  abort: cannot specify both --abort and --preview
   [255]
 
   $ hg abort