Why Does Update with No Args Move Bookmark?
Stephen Lee
sphen.lee at gmail.com
Tue Oct 15 23:48:29 UTC 2013
>> Whenever I create a branch, Mercurial warns me: "branches are permanent and global, did you want a bookmark?" If
>> bookmarks are supposed to be lightweight branches, moving a bookmark on an update breaks that model. If I run
>> `hg up` without any arguments, if I'm on a line that has a bookmark, it should update to or keep me on the bookmark, not
>> to some other line. Moving the bookmark breaks the branch-iness of the bookmark. This behavior makes it really unlikely
>> (as others have attested) that I'll ever use this feature. And I really, really want to use this feature.
I think this feature is also a legacy from when bookmarks were local-only.
Typically the server would have a single head on each branch.
Developers would create local heads and place bookmarks on them. If
there is exactly one head on the current named branch with no
bookmarks, "hg up" selects it.
In this way, bookmarks are lightweight branches, and the un-bookmarked
head is the master/upstream branch.
So if you have not made any commits on your lightweight branch, "hg
pull ; hg up" does the right thing.
Now that bookmarks are transferred over the network this behaviour
makes less sense.
Also, if you setup a workflow where every head is bookmarked, "hg up"
doesn't do anything (all heads are bookmarks, select an explicit
revision).
>
> My impression is that bookmarks were implemented to generally act how Git branches do. With my luck, that's probably completely wrong. :p But as someone who has never used Git and doesn't share repos with a large number of other people, bookmarks never seem to act the way I want\expect them to and I've mostly stopped using them.
Bookmarks try to emulate the Git behaviour: 1) without the
complication/confusion and 2) without breaking the non-bookmark usage.
It's still not clear if these goals are compatible.
>
> i.e. When I'm bookmarking a revision, I'm bookmarking that specific change set, not that branch, not that tip, etc. If I add a new commit, I want the bookmark to stay where it was. If I do some history editing and strip a bookmarked change set, I want the bookmark to be deleted also, not moved to the first undeleted ancestor.
Have you looked at local tags? They seem to be a better fit for the
needs you describe here.
Steve
More information about the Mercurial
mailing list