changeset 43902:e623ad1b4800

bookmarks: use check_incompatible_arguments() for inactive+action Differential Revision: https://phab.mercurial-scm.org/D7662
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 13 Dec 2019 14:31:51 -0800
parents 5cde16489b42
children d50b4ad1d4a5
files mercurial/commands.py tests/test-bookmarks.t
diffstat 2 files changed, 3 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Dec 12 23:32:47 2019 -0800
+++ b/mercurial/commands.py	Fri Dec 13 14:31:51 2019 -0800
@@ -1236,8 +1236,7 @@
     else:
         action = b'list'
 
-    if inactive and action in {b'delete', b'list'}:
-        raise error.Abort(_(b"--inactive is incompatible with --%s") % action)
+    cmdutil.check_incompatible_arguments(opts, b'inactive', b'delete', b'list')
     if not names and action in {b'add', b'delete'}:
         raise error.Abort(_(b"bookmark name required"))
 
--- a/tests/test-bookmarks.t	Thu Dec 12 23:32:47 2019 -0800
+++ b/tests/test-bookmarks.t	Fri Dec 13 14:31:51 2019 -0800
@@ -84,7 +84,7 @@
   abort: cannot specify both --list and --rev
   [255]
   $ hg bookmarks -l --inactive
-  abort: --inactive is incompatible with --list
+  abort: cannot specify both --inactive and --list
   [255]
 
   $ hg log -T '{bookmarks % "{rev} {bookmark}\n"}'
@@ -347,7 +347,7 @@
 delete with --inactive
 
   $ hg bookmark -d --inactive Y
-  abort: --inactive is incompatible with --delete
+  abort: cannot specify both --inactive and --delete
   [255]
 
 bookmark name with spaces should be stripped