# HG changeset patch # User David Soria Parra # Date 1298159875 -3600 # Node ID 97b69883e929326dcfc5caaf306bb767211d3331 # Parent 931a72e00efa2b7d25f43ceaac225e5cfa0eaa55 bookmarks: mark new bookmark as current if it points to the current dirstate hg bookmark -r ancestorrev X will not mark X as the current bookmark anymore. If you want to point a bookmark to a ancestor rev you will use hg update to move to it. This will set the current bookmark. diff -r 931a72e00efa -r 97b69883e929 mercurial/commands.py --- a/mercurial/commands.py Fri Feb 18 20:25:25 2011 +0100 +++ b/mercurial/commands.py Sun Feb 20 00:57:55 2011 +0100 @@ -521,7 +521,8 @@ marks[mark] = repo.lookup(rev) else: marks[mark] = repo.changectx('.').node() - bookmarks.setcurrent(repo, mark) + if repo.changectx('.').node() == marks[mark]: + bookmarks.setcurrent(repo, mark) bookmarks.write(repo) return diff -r 931a72e00efa -r 97b69883e929 tests/test-bookmarks.t --- a/tests/test-bookmarks.t Fri Feb 18 20:25:25 2011 +0100 +++ b/tests/test-bookmarks.t Sun Feb 20 00:57:55 2011 +0100 @@ -55,7 +55,7 @@ $ hg bookmarks X 0:f7b1eb17ad24 - X2 0:f7b1eb17ad24 + * X2 0:f7b1eb17ad24 Y -1:000000000000 $ echo b > b @@ -67,19 +67,25 @@ $ hg log -r 'bookmark()' changeset: 0:f7b1eb17ad24 bookmark: X - bookmark: X2 user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: 0 + changeset: 1:925d80f479bb + bookmark: X2 + tag: tip + user: test + date: Thu Jan 01 00:00:00 1970 +0000 + summary: 1 + $ hg log -r 'bookmark(Y)' $ hg log -r 'bookmark(X2)' - changeset: 0:f7b1eb17ad24 - bookmark: X + changeset: 1:925d80f479bb bookmark: X2 + tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 - summary: 0 + summary: 1 $ hg help revsets | grep 'bookmark(' "bookmark([name])" @@ -88,7 +94,7 @@ $ hg bookmarks X 0:f7b1eb17ad24 - X2 0:f7b1eb17ad24 + * X2 1:925d80f479bb Y -1:000000000000 bookmark rev 0 again @@ -106,7 +112,7 @@ $ hg bookmarks * X 2:db815d6d32e6 - X2 0:f7b1eb17ad24 + X2 1:925d80f479bb Y -1:000000000000 Z 0:f7b1eb17ad24 @@ -129,7 +135,7 @@ list bookmarks $ hg bookmark - X2 0:f7b1eb17ad24 + X2 1:925d80f479bb * Y 2:db815d6d32e6 Z 0:f7b1eb17ad24 @@ -158,7 +164,7 @@ list bookmarks $ hg bookmarks - X2 0:f7b1eb17ad24 + X2 1:925d80f479bb Y 2:db815d6d32e6 Z 0:f7b1eb17ad24 * x y 2:db815d6d32e6 @@ -196,7 +202,7 @@ list bookmarks $ hg bookmark - X2 0:f7b1eb17ad24 + X2 1:925d80f479bb Y 2:db815d6d32e6 * Z 2:db815d6d32e6 x y 2:db815d6d32e6