Patchwork [7,of,9] bookmarks: reject --delete with --inactive which makes no sense

login
register
mail settings
Submitter Yuya Nishihara
Date Sept. 21, 2018, 1:24 p.m.
Message ID <27e99ca7224b0fe21409.1537536249@mimosa>
Download mbox | patch
Permalink /patch/34900/
State Accepted
Headers show

Comments

Yuya Nishihara - Sept. 21, 2018, 1:24 p.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1536982453 -32400
#      Sat Sep 15 12:34:13 2018 +0900
# Node ID 27e99ca7224b0fe214091df83e8e24dee3ffb725
# Parent  99d6d63325c1b44de2985413ead1ac0a53948be2
bookmarks: reject --delete with --inactive which makes no sense

A deleted bookmark is neither active nor inactive.

Patch

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -980,8 +980,8 @@  def bookmark(ui, repo, *names, **opts):
         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"))
 
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -327,6 +327,12 @@  delete nonexistent bookmark
   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 '