bookmarks: allow deactivating current bookmark with -i
authorKevin Bullock <kbullock@ringworld.org>
Wed, 04 May 2011 10:43:47 -0500
changeset 14189 328422b0380d
parent 14188 9029b1a38c30
child 14190 8aab5a82685f
bookmarks: allow deactivating current bookmark with -i
mercurial/commands.py
tests/test-bookmarks-current.t
tests/test-debugcomplete.t
--- a/mercurial/commands.py	Sat Dec 11 18:08:55 2010 +0100
+++ b/mercurial/commands.py	Wed May 04 10:43:47 2011 -0500
@@ -539,6 +539,9 @@
         if not mark:
             raise util.Abort(_("bookmark names cannot consist entirely of "
                                "whitespace"))
+        if inactive and mark == repo._bookmarkcurrent:
+            bookmarks.setcurrent(repo, None)
+            return
         if mark in marks and not force:
             raise util.Abort(_("bookmark '%s' already exists "
                                "(use -f to force)") % mark)
--- a/tests/test-bookmarks-current.t	Sat Dec 11 18:08:55 2010 +0100
+++ b/tests/test-bookmarks-current.t	Wed May 04 10:43:47 2011 -0500
@@ -106,3 +106,22 @@
   $ hg bookmarks
    * Y                         0:719295282060
      Z                         0:719295282060
+
+deactivate current bookmark using -i
+
+  $ hg bookmark -i Y
+  $ hg bookmarks
+     Y                         0:719295282060
+     Z                         0:719295282060
+
+  $ hg up -q Y
+  $ hg bookmarks
+   * Y                         0:719295282060
+     Z                         0:719295282060
+
+deactivate current bookmark while renaming
+
+  $ hg bookmark -i -m Y X
+  $ hg bookmarks
+     X                         0:719295282060
+     Z                         0:719295282060
--- a/tests/test-debugcomplete.t	Sat Dec 11 18:08:55 2010 +0100
+++ b/tests/test-debugcomplete.t	Wed May 04 10:43:47 2011 -0500
@@ -205,7 +205,7 @@
   archive: no-decode, prefix, rev, type, subrepos, include, exclude
   backout: merge, parent, tool, rev, include, exclude, message, logfile, date, user
   bisect: reset, good, bad, skip, extend, command, noupdate
-  bookmarks: force, rev, delete, rename
+  bookmarks: force, rev, delete, rename, inactive
   branch: force, clean
   branches: active, closed
   bundle: force, rev, branch, base, all, type, ssh, remotecmd, insecure