hg update and bookmarks
Kevin Bullock
kbullock+mercurial at ringworld.org
Mon Dec 31 03:33:20 UTC 2012
On 29 Dec 2012, at 3:35 AM, Christian Widmer wrote:
> hg help update says that if it will move the current bookmark. isn't this a bit dangerous? image that i am currently on bookmark 'f1' and have just pulled a new revision with bookmark 'f2'. hg update will not not only update to tip but also move my 'f1' to the new 'tip'. thus i just loosed track of my feature branch. actually my 'f1' is not tracking 'f2'.
The assumption is that if you pull and update, you want your active bookmark to come along with you. Imagine this: you clone an upstream repository, and set a bookmark to work on a topic branch ('f1'). Later you pull some changes from the upstream repository. If a bare 'hg update' brings you to the new head ('f2'), that means that it's a direct descendent of your current work. That means either you made no commits on your feature branch, or your feature branch has already been integrated upstream. In either case, you probably want any further work on your feature branch to be based on the latest upstream sources.
Note that the help says "if no changeset is specified", the active bookmark will be moved. Let's say you've cloned that same upstream repo, started a bookmarked topic branch, made some commits, and then pull new changes. If you try a bare 'hg update', hg will tell you something like "abort: crosses branches (merge branches or update --check to discard changes)". If you follow the second hint and run 'hg update --check', the active bookmark _does not move_.
> why does it not behave like with named branches?
Because bookmarks are not named branches. They're ephemeral, external markers on history. They still have some rough edges, and the auto-update behavior is actually one part of ongoing work to make them better.
pacem in terris / мир / शान्ति / سَلاَم / 平和
Kevin R. Bullock
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial/attachments/20121230/535fdc8e/attachment-0002.html>
More information about the Mercurial
mailing list