[Updated] D8668: graft: leverage cmdutil.check_incompatible_arguments() for --no-commit

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


Closed by commit rHGc63a297fb964: graft: leverage cmdutil.check_incompatible_arguments() for --no-commit (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/D8668?vs=21718&id=21727

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

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

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
@@ -553,15 +553,15 @@
 Check reporting when --no-commit used with non-applicable options:
 
   $ hg graft 1 --no-commit -e
-  abort: cannot specify --no-commit and --edit together
+  abort: cannot specify both --no-commit and --edit
   [255]
 
   $ hg graft 1 --no-commit --log
-  abort: cannot specify --no-commit and --log together
+  abort: cannot specify both --no-commit and --log
   [255]
 
   $ hg graft 1 --no-commit -D
-  abort: cannot specify --no-commit and --currentdate together
+  abort: cannot specify both --no-commit and --currentdate
   [255]
 
 Test --no-commit is working:
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2986,22 +2986,11 @@
 
     cont = False
     if opts.get(b'no_commit'):
-        if opts.get(b'edit'):
-            raise error.Abort(
-                _(b"cannot specify --no-commit and --edit together")
-            )
-        if opts.get(b'currentuser'):
-            raise error.Abort(
-                _(b"cannot specify --no-commit and --currentuser together")
-            )
-        if opts.get(b'currentdate'):
-            raise error.Abort(
-                _(b"cannot specify --no-commit and --currentdate together")
-            )
-        if opts.get(b'log'):
-            raise error.Abort(
-                _(b"cannot specify --no-commit and --log together")
-            )
+        cmdutil.check_incompatible_arguments(
+            opts,
+            b'no_commit',
+            [b'edit', b'currentuser', b'currentdate', b'log'],
+        )
 
     graftstate = statemod.cmdstate(repo, b'graftstate')
 



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/af2eafd9/attachment-0002.html>


More information about the Mercurial-patches mailing list