Mercurial > hg
changeset 13448:97b69883e929 stable
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.
author | David Soria Parra <dsp@php.net> |
---|---|
date | Sun, 20 Feb 2011 00:57:55 +0100 |
parents | 931a72e00efa |
children | 8b1125eb361e |
files | mercurial/commands.py tests/test-bookmarks.t |
diffstat | 2 files changed, 18 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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
--- 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