When you don't have any active bookmark. Updating to a revision that happen to have a bookmark may enable this bookmark. This happen if the bookmark was the last you had active. The following updated test case: diff --git a/tests/test-bookmarks.t b/tests/test-bookmarks.t --- a/tests/test-bookmarks.t +++ b/tests/test-bookmarks.t @@ -342,10 +342,25 @@ create bundle with two heads X2 1:925d80f479bb Y 2:db815d6d32e6 * Z 3:125c9a1d6df6 x y 2:db815d6d32e6 + $ hg up -C 1 + 1 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ hg bookmarks + X2 1:925d80f479bb + Y 2:db815d6d32e6 + Z 3:125c9a1d6df6 + x y 2:db815d6d32e6 + $ hg up 3 + 2 files updated, 0 files merged, 1 files removed, 0 files unresolved + $ hg bookmarks + X2 1:925d80f479bb + Y 2:db815d6d32e6 + Z 3:125c9a1d6df6 + x y 2:db815d6d32e6 + test wrongly formated bookmark $ echo '' >> .hg/bookmarks $ hg bookmarks X2 1:925d80f479bb Fails as follow: --- /home/pyves/src/mercurial-dev/tests/test-bookmarks.t +++ /home/pyves/src/mercurial-dev/tests/test-bookmarks.t.err @@ -356,7 +356,7 @@ $ hg bookmarks X2 1:925d80f479bb Y 2:db815d6d32e6 - Z 3:125c9a1d6df6 + * Z 3:125c9a1d6df6 x y 2:db815d6d32e6
I remember seeing this about a year ago: http://mercurial.markmail.org/thread/rhrwvpt6tshdv6pj Don't really remember if there was anything concrete that prevented changing this.
I was hoping to get an enumeration of the rules for active bookmarks. That probably looks something like this: 1. A bookmark becomes active on creation if it's for '.' 2. A bookmark becomes active when you update to it explicitly 3. Activating a bookmark deactivates any previous bookmark 4. An active bookmark is moved forward by commit or -bare update- 5. A bookmark remains active during merge 6. A bookmark becomes inactive when you do any other sort of update So Idan's patch is probably correct, though it'd be nice if these rules were somehow confined to and documented in bookmarks.py rather than scattered throughout the code. Also, there's the whole business with "current/active" in the code that confuses matters.
I think that's a reasonably complete list. We might start with: 0. A bookmark is active (or synonymously, current) when it points to '.' and is listed in bookmarks.current Note that (4) and (5) taken together imply that the following: $ hg up @ $ hg merge feature-branch $ hg ci -m 'merge feature-branch' results in feature-branch staying put on the second parent of the merge (issue1877).
Yeah, I think we ought to purge either the "active" or "current" jargon. Probably "current" because we've got command line options that mention active.
Idan, can you resend that patch?
Sure, I'd like to go over it again so expect it shortly after Monday (got a test).
Fixed by http://selenic.com/repo/hg/rev/7c75924a6926 Idan Kamara <idankk86@gmail.com> update: delete bookmarks.current when explicitly updating to a rev (issue3276) (please test the fix)
--- Bug imported by bugzilla@serpentine.com 2012-05-12 09:28 EDT --- This bug was previously known as _bug_ 3276 at http://mercurial.selenic.com/bts/issue3276