# HG changeset patch # User Sean Farley # Date 1367439861 18000 # Node ID 23f785b38af38d2fca6b8f3db56b8007a84cd73a # Parent 6439d78e14fbc6103eeca115af509d23b5b7e17e bookmarks: fix bug that activated a bookmark even with -r passed If the current revision was the target revision of -r, then the bookmark would be active. Test cases have been updated accordingly. diff -r 6439d78e14fb -r 23f785b38af3 mercurial/commands.py --- a/mercurial/commands.py Tue Apr 30 21:12:49 2013 -0500 +++ b/mercurial/commands.py Wed May 01 15:24:21 2013 -0500 @@ -880,7 +880,7 @@ tgt = scmutil.revsingle(repo, rev).node() checkconflict(repo, mark, force, tgt) marks[mark] = tgt - if not inactive and cur == marks[mark]: + if not inactive and cur == marks[mark] and not rev: bookmarks.setcurrent(repo, mark) elif cur != tgt and mark == repo._bookmarkcurrent: bookmarks.setcurrent(repo, None) diff -r 6439d78e14fb -r 23f785b38af3 tests/test-bookmarks-current.t --- a/tests/test-bookmarks-current.t Tue Apr 30 21:12:49 2013 -0500 +++ b/tests/test-bookmarks-current.t Wed May 01 15:24:21 2013 -0500 @@ -91,14 +91,19 @@ $ hg update tip 0 files updated, 0 files merged, 0 files removed, 0 files unresolved -set bookmark Y using -r . +set bookmark Y using -r . but make sure that the active +bookmark is not activated $ hg bookmark -r . Y -list bookmarks +list bookmarks, Y should not be active $ hg bookmark - * Y 0:719295282060 + Y 0:719295282060 + +now, activate Y + + $ hg up -q Y set bookmark Z using -i diff -r 6439d78e14fb -r 23f785b38af3 tests/test-bookmarks-rebase.t --- a/tests/test-bookmarks-rebase.t Tue Apr 30 21:12:49 2013 -0500 +++ b/tests/test-bookmarks-rebase.t Wed May 01 15:24:21 2013 -0500 @@ -26,6 +26,7 @@ $ hg bookmark -r 1 one $ hg bookmark -r 3 two + $ hg up -q two bookmark list diff -r 6439d78e14fb -r 23f785b38af3 tests/test-bookmarks.t --- a/tests/test-bookmarks.t Tue Apr 30 21:12:49 2013 -0500 +++ b/tests/test-bookmarks.t Wed May 01 15:24:21 2013 -0500 @@ -157,6 +157,7 @@ bookmarks from a revset $ hg bookmark -r '.^1' REVSET $ hg bookmark -r ':tip' TIP + $ hg up -q TIP $ hg bookmarks REVSET 0:f7b1eb17ad24 * TIP 2:db815d6d32e6 @@ -601,8 +602,8 @@ Z 0:f7b1eb17ad24 Z@1 1:925d80f479bb Z@2 2:db815d6d32e6 - * Z@3 3:9ba5f110a0b3 - four 3:9ba5f110a0b3 + Z@3 3:9ba5f110a0b3 + * four 3:9ba5f110a0b3 should-end-on-two 2:db815d6d32e6 $ hg bookmark Z moving bookmark 'Z' forward from f7b1eb17ad24 @@ -620,9 +621,9 @@ $ hg book foo@3 -r 3 $ hg book foo -r foo@3 $ hg book - Z 3:9ba5f110a0b3 + * Z 3:9ba5f110a0b3 Z@1 1:925d80f479bb - * foo 3:9ba5f110a0b3 + foo 3:9ba5f110a0b3 foo@1 0:f7b1eb17ad24 foo@2 2:db815d6d32e6 four 3:9ba5f110a0b3