Some thoughts about Mercurial bookmarks
David Demelier
demelier.david at gmail.com
Tue May 12 15:16:54 UTC 2015
Hello,
When I started to work with other people, I've searched for several
workflows that could be nice to use.
I know a little bit how Git works and wanted to do the same with
Mercurial. I heard of bookmarks and since they are popular and the
recommended way, I've tried to use it for several weeks.
But I've encountered several issues that I personally think inconvenient:
1. Bookmarks are not deleted upon a pull
When you pull from a repository and that you have local bookmarks that
are not present on the remote, the bookmarks stay locally. I understand
that it is important that Mercurial does not delete bookmarks as you can
privately use them, but I suggest that it can be automatically deleted
if the bookmark was not created manually (e.g always from pull, not from
hg bookmark).
Or maybe a hg pull option like hg pull -d?
2. Calling hg update moves the bookmark automatically
This issue bugs me because I didn't expect that hg update would move a
bookmark. I think it's rather confusing because some poeple like to
track changes periodically by doing hg pull && hg update. If no argument
is specified you may move the bookmark by mistake.
It's even more unsafe when you use the special @ bookmark that is a bit
similar to Git's master branch. Someone may move the "stable" @ bookmark
to the most recent feature bookmark which are still experimental code.
3. Rebase extension does not move bookmarks
When using Git, creating a branch is like creating a bookmark, it does
not create new heads. Thus, when you're done with your work, you can
just do git rebase and all of the code is merged.
By contrast, Mercurial will only allow rebasing if the bookmark revision
is actually in a different head, that means you have to check manually
the tree for what action you must do, either rebasing or moving yourself
the bookmark where you want.
I suggest that hg rebase could simply move the bookmark from the source
to the destination if they are in the same head and to a real rebase
instead.
Of course, an other "uniform" rebase command would also be welcome.
I personally think that bookmark is a nice approach to the Git branches,
but at the moment I still think that they are a bit inconvenient to use
and that's probably why they are not well supported in BitBucket
(especially the reason #3).
At the moment, I'll stick with named branches + hg rebase :-). I just
need to ignore the "did you want a bookmark?" warning ;-).
Regards,
David.
More information about the Mercurial
mailing list