Patchwork D7648: bookmarks: use cmdutil.check_unique_argument() for action+rev

login
register
mail settings
Submitter phabricator
Date Dec. 13, 2019, 11:01 p.m.
Message ID <f096315397313e3ae204f73d9ccfa9d0@localhost.localdomain>
Download mbox | patch
Permalink /patch/43828/
State Not Applicable
Headers show

Comments

phabricator - Dec. 13, 2019, 11:01 p.m.
martinvonz updated this revision to Diff 18717.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7648?vs=18683&id=18717

BRANCH
  default

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

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

AFFECTED FILES
  mercurial/commands.py
  tests/test-bookmarks.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -81,7 +81,7 @@ 
   abort: bookmark 'A' does not exist
   [255]
   $ hg bookmarks -l -r0
-  abort: --rev is incompatible with --list
+  abort: cannot specify both --list and --rev
   [255]
   $ hg bookmarks -l --inactive
   abort: --inactive is incompatible with --list
@@ -479,11 +479,11 @@ 
   [255]
 
   $ hg bookmark -r 1 -d Z
-  abort: --rev is incompatible with --delete
+  abort: cannot specify both --delete and --rev
   [255]
 
   $ hg bookmark -r 1 -m Z Y
-  abort: --rev is incompatible with --rename
+  abort: cannot specify both --rename and --rev
   [255]
 
 force bookmark with existing name
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1228,7 +1228,7 @@ 
 
     action = cmdutil.check_unique_argument(opts, b'delete', b'rename', b'list')
     if action:
-        pass
+        cmdutil.check_incompatible_arguments(opts, action, b'rev')
     elif names or rev:
         action = b'add'
     elif inactive:
@@ -1236,8 +1236,6 @@ 
     else:
         action = b'list'
 
-    if rev and action in {b'delete', b'rename', b'list'}:
-        raise error.Abort(_(b"--rev is incompatible with --%s") % action)
     if inactive and action in {b'delete', b'list'}:
         raise error.Abort(_(b"--inactive is incompatible with --%s") % action)
     if not names and action in {b'add', b'delete'}: