[PATCH 2 of 2] bookmarks: moving the active bookmark deactivates it
Kevin Bullock
kbullock+mercurial at ringworld.org
Sat Mar 16 22:56:19 CDT 2013
# HG changeset patch
# User Kevin Bullock <kbullock at ringworld.org>
# Date 1363492102 18000
# Node ID 22f87dc77604a4a305d5fc66bf4612b2996fec27
# Parent 99b78269a2ec850359fb7de8aca385008924a0ab
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.
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -869,6 +869,8 @@ def bookmark(ui, repo, mark=None, rev=No
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
diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t
--- a/tests/test-bookmarks.t
+++ b/tests/test-bookmarks.t
@@ -280,7 +280,15 @@ incompatible options
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
@@ -360,7 +368,7 @@ test rollback
$ 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
More information about the Mercurial-devel
mailing list