bookmarks: reject --delete with --inactive which makes no sense
authorYuya Nishihara <yuya@tcha.org>
Sat, 15 Sep 2018 12:34:13 +0900
changeset 39752 2d478b05fb14
parent 39751 5dfc0ca02aa0
child 39753 b05b4b91de3d
bookmarks: reject --delete with --inactive which makes no sense A deleted bookmark is neither active nor inactive.
mercurial/commands.py
tests/test-bookmarks.t
--- a/mercurial/commands.py	Sat Sep 15 12:32:01 2018 +0900
+++ b/mercurial/commands.py	Sat Sep 15 12:34:13 2018 +0900
@@ -980,8 +980,8 @@
         raise error.Abort(_("--rev is incompatible with --%s") % action)
     if names and action == 'active':
         raise error.Abort(_("NAMES is incompatible with --active"))
-    if inactive and action == 'active':
-        raise error.Abort(_("--inactive is incompatible with --active"))
+    if inactive and action in {'delete', 'active'}:
+        raise error.Abort(_("--inactive is incompatible with --%s") % action)
     if not names and action in {'add', 'delete'}:
         raise error.Abort(_("bookmark name required"))
 
--- a/tests/test-bookmarks.t	Sat Sep 15 12:32:01 2018 +0900
+++ b/tests/test-bookmarks.t	Sat Sep 15 12:34:13 2018 +0900
@@ -327,6 +327,12 @@
   abort: bookmark 'A' does not exist
   [255]
 
+delete with --inactive
+
+  $ hg bookmark -d --inactive Y
+  abort: --inactive is incompatible with --delete
+  [255]
+
 bookmark name with spaces should be stripped
 
   $ hg bookmark ' x  y '