Commits

Kevin Bullock  committed 22f87dc

bookmarks: moving the active bookmark deactivates it

After this change, moving the active bookmark somewhere other than the
current changeset (i.e., with --rev) deactivates it. Previously it would
remain in .hg/bookmarks.current, which seems like a bug.

  • Participants
  • Parent commits 99b7826

Comments (0)

Files changed (2)

File mercurial/commands.py

         marks[mark] = tgt
         if not inactive and cur == marks[mark]:
             bookmarks.setcurrent(repo, mark)
+        elif cur != tgt and mark == repo._bookmarkcurrent:
+            bookmarks.setcurrent(repo, None)
         marks.write()
 
     # Same message whether trying to deactivate the current bookmark (-i

File tests/test-bookmarks.t

 force bookmark with existing name
 
   $ hg bookmark -f X2
+
+force bookmark back to where it was, should deactivate it
+
   $ hg bookmark -fr1 X2
+  $ hg bookmarks
+     X2                        1:925d80f479bb
+     Y                         2:db815d6d32e6
+     Z                         0:f7b1eb17ad24
+     x  y                      2:db815d6d32e6
 
 forward bookmark to descendant without --force
 
   $ hg bookmarks
      X2                        1:925d80f479bb
      Y                         2:db815d6d32e6
-   * Z                         2:db815d6d32e6
+     Z                         2:db815d6d32e6
      x  y                      2:db815d6d32e6
 
 activate bookmark on working dir parent without --force