[RFC] remote bookmark tracking

Alexander Solovyov alexander at solovyov.net
Thu Feb 3 17:11:50 CST 2011


Hi all,

I want to bring to discussing one thing which bothers me a lot lately. We are
using bookmarks a lot for our work and the way they work is sometimes just
undesirable.

For example, you have remote repository 'dev' and two users working on a same
feature branch, identified by a bookmark. When one user pushes his 'feature'
bookmark with a set of changes to this repository, another one is stuck with one
of four ways:

1) just 'hg pull dev' - this will say that bookmarks are diverged, so there is
no way to identify other head of this branch of development.

2) hg pull -B feature dev - this will override bookmark, so he will lost name
for his head of this branch of development.

3) hg push - this will push his changes (assuming there are already more than
one head on this named branch), but won't push bookmark name.

3) hg push -f - this will override remote bookmark, which will switch from one
head to another.

Of course, pushing is just a bit dumb in this case, but anyway the only viable
strategy right now seems to do 'hg pull -B feature dev' followed by immediate
merge. When pull was done to study changes, but merge is not possible by some
reason, you're stuck in quite unfriendly situation. :(

What I propose here is introducing tracking of remote bookmarks. Upon a pull
from repository, mentioned in [paths], corresponding bookmarks with names like
'remote/path/bookmark' will be created (prefix 'remote/' should be forbidden
then for a name of a bookmark).

There are few things to think about:

1) We may want to introduce concept of local bookmarks tracking remote
ones. This could be optional third value in .hg/bookmarks, which will move your
local bookmark on pull if remote is updated, is not diverged with local one and
is not your current bookmark.

2) When you push your branch to remote server with only one head, which is
marked with same branch you're trying to push, you'll need to specify '-f',
which will not only push a new head, but also force a move of a bookmark. Maybe
better behavior can be introduced here.

I'm almost sure I missed a lot of things here, but I'd really like to see this
stuff discussed and I was delaying writing this mail for too long time (and
probably it's already too late to make it in 1.8, but whatever).

-- 
Alexander


More information about the Mercurial-devel mailing list