[Updated] D8667: graft: leverage cmdutil.check_at_most_one_arg() for --abort/--stop/--continue

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Mon Jun 29 10:32:51 UTC 2020


Closed by commit rHG7d494425167c: graft: leverage cmdutil.check_at_most_one_arg() for --abort/--stop/--continue (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D8667?vs=21717&id=21726

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D8667/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D8667

AFFECTED FILES
  mercurial/commands.py
  tests/test-graft-interrupted.t

CHANGE DETAILS

diff --git a/tests/test-graft-interrupted.t b/tests/test-graft-interrupted.t
--- a/tests/test-graft-interrupted.t
+++ b/tests/test-graft-interrupted.t
@@ -249,7 +249,7 @@
   [1]
 
   $ hg graft --stop --continue
-  abort: cannot use '--continue' and '--stop' together
+  abort: cannot specify both --stop and --continue
   [255]
 
   $ hg graft --stop -U
@@ -355,11 +355,11 @@
   [1]
 
   $ hg graft --continue --abort
-  abort: cannot use '--continue' and '--abort' together
+  abort: cannot specify both --abort and --continue
   [255]
 
   $ hg graft --abort --stop
-  abort: cannot use '--abort' and '--stop' together
+  abort: cannot specify both --abort and --stop
   [255]
 
   $ hg graft --abort --currentuser
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2982,6 +2982,8 @@
         editform=b'graft', **pycompat.strkwargs(opts)
     )
 
+    cmdutil.check_at_most_one_arg(opts, b'abort', b'stop', b'continue')
+
     cont = False
     if opts.get(b'no_commit'):
         if opts.get(b'edit'):
@@ -3004,13 +3006,6 @@
     graftstate = statemod.cmdstate(repo, b'graftstate')
 
     if opts.get(b'stop'):
-        if opts.get(b'continue'):
-            raise error.Abort(
-                _(b"cannot use '--continue' and '--stop' together")
-            )
-        if opts.get(b'abort'):
-            raise error.Abort(_(b"cannot use '--abort' and '--stop' together"))
-
         if any(
             (
                 opts.get(b'edit'),
@@ -3025,10 +3020,6 @@
             raise error.Abort(_(b"cannot specify any other flag with '--stop'"))
         return _stopgraft(ui, repo, graftstate)
     elif opts.get(b'abort'):
-        if opts.get(b'continue'):
-            raise error.Abort(
-                _(b"cannot use '--continue' and '--abort' together")
-            )
         if any(
             (
                 opts.get(b'edit'),



To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20200629/8633c128/attachment-0002.html>


More information about the Mercurial-patches mailing list