Why did "hg push", push my local bookmark to remote?

Jaikiran Pai jai.forums2013 at gmail.com
Fri Feb 6 05:46:35 UTC 2015


I used to be a git user but have been using mercurial in a recent 
project, for a while now. Just recently, I decided to use the "bookmark" 
feature of mercurial to have lightweight branches similar to git. The 
documentation at various places about bookmark suggests that if I have a 
(local) bookmark and commits in that booking and I'm pushing to a remote 
repository, then the commits to the bookmark will *not* be pushed to the 
remote repository unless the remote repository has that bookmark too. 
That's a good thing and that's what I want. However, that doesn't seem 
to be how it's working (I was on 2.8 version of mercurial but it's the 
same with 3.3 too). Here's what I did:

hg bookmark test-bookmark // create a new bookmark
hg up test-bookmark // up to that bookmark
... update an existing file in the workspace
hg commit -m "Dummy test commit in bookmark" // commit the local change
hg push // push to remote

To my surprise, the commit that I did  to the bookmark got pushed to the 
remote repo and is now visible/available to everyone and has the 
potential to cause problems (since it was a work in progress change). I 
didn't explicitly push the bookmark, yet it got pushed to remote by a 
plain hg push. Did I miss something about how bookmarks work in mercurial?


-Jaikiran


More information about the Mercurial mailing list