Mercurial Bookmarks and Git as Branching "

I was not lucky to use bookmarks in Mercurial for Git as a branch.

From the article: https://www.mercurial-scm.org/wiki/BookmarksExtension , I set "track.current" to true in my .hgrc file.

Excerpt below:

By default, when multiple bookmarks indicate the same set of changes, they will all move forward together. it's possible to get a more git-like experience by adding the following configuration for your .hgrc

[bookmarks] track.current = True 

However, as soon as I start trying to do parallel / independent development on multiple bookmarks, then switch between bookmarks, I run the following:

 abort: crosses branches (use 'hg merge' or 'hg update -C') 

Playback Example:

 # Make a new directory and Mercurial repository $ mkdir bookmark $ cd bookmark $ hg init # Create two bookmarks $ hg bookmark bk1 $ hg bookmark bk2 # Checkout bk1 $ hg update bk1 0 files updated, 0 files merged, 0 files removed, 0 files unresolved # Create and commit a file to bk1 $ touch bk1.txt $ hg add adding bk1.txt $ hg commit -m "bk1 file" # Checkout bk2 $ hg update bk2 0 files updated, 0 files merged, 1 files removed, 0 files unresolved # Create and commit a file to bk2 $ touch bk2.txt $ hg add adding bk2.txt $ hg commit -m "bk2 file" created new head # Checkout bk1 $ hg up bk1 abort: crosses branches (use 'hg merge' or 'hg update -C') 

Is this common behavior because there are “intersecting branches” that force merging or rewriting of the file when moving between bookmarks?

In the case of a "Git-like experience," I would expect that you can move between bk1 and bk2, commit and develop on both, merging when and when I need to.

+6
git version-control dvcs mercurial
source share
2 answers

Please update Mercurial 1.4, which was released last week. Then you can switch between heads on a branch without warning.

+16
source share

Using a version of Mercurial earlier than 1.4, you can simply specify the -c flag if your working tree is clean (no uncommitted changes).

+2
source share

All Articles