changeset 17735:605fe310691f stable

bookmarks: deactivate current bookmark if no name is given f57f891eb88e added this help text to hg bookmark: If no NAME is given, the current active bookmark will be marked inactive. But that was never actually the case. Originally spotted by Idan Kamara <idankk86@gmail.com>.
author Kevin Bullock <kbullock@ringworld.org>
date Mon, 08 Oct 2012 00:19:30 +0200
parents 6929b9c70be9
children 1c523c4008f7 d118a4f4fd16
files mercurial/commands.py tests/test-bookmarks-current.t
diffstat 2 files changed, 13 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Oct 04 16:30:40 2012 +0200
+++ b/mercurial/commands.py	Mon Oct 08 00:19:30 2012 +0200
@@ -846,6 +846,12 @@
             raise util.Abort(_("bookmark name required"))
         if len(marks) == 0:
             ui.status(_("no bookmarks set\n"))
+        if inactive:
+            if not repo._bookmarkcurrent:
+                ui.status(_("no active bookmark\n"))
+            else:
+                bookmarks.setcurrent(repo, None)
+            return
         else:
             for bmark, n in sorted(marks.iteritems()):
                 current = repo._bookmarkcurrent
--- a/tests/test-bookmarks-current.t	Thu Oct 04 16:30:40 2012 +0200
+++ b/tests/test-bookmarks-current.t	Mon Oct 08 00:19:30 2012 +0200
@@ -115,6 +115,13 @@
      Z                         0:719295282060
 
   $ hg up -q Y
+  $ hg bookmark -i
+  $ hg bookmarks
+     Y                         0:719295282060
+     Z                         0:719295282060
+  $ hg bookmark -i
+  no active bookmark
+  $ hg up -q Y
   $ hg bookmarks
    * Y                         0:719295282060
      Z                         0:719295282060