Playing a branching git model using mercurial bookmarks

I am trying to use Mercurial and I want to reproduce a branching git model using the Bookmark extension. This is where the problem is.

Imagine I have a repostar. I added 2 bookmarks

user@host :/tmp/hgtest$ hg bookmark main user@host :/tmp/hgtest$ hg bookmark feature user@host :/tmp/hgtest$ hg bookmarks * feature 0:76c6736b4548 main 0:76c6736b4548 

After that I made some code and decided that the function is ready (in the near future there will be no development of this function). At this point, bookmarks point to different commits.

 user@host :/tmp/hgtest$ hg bookmarks * feature 2:9d32bb6bdbc6 main 0:76c6736b4548 

Now I am going back to the state in which I started developing my function

 user@host :/tmp/hgtest$ hg up main resolving manifests removing second.file getting first.file 1 files updated, 0 files merged, 1 files removed, 0 files unresolved 

I would like to issue the merge command to make the history graph look like

 user@host :/tmp/test-git$ git log --graph * commit d8a957350fc8fbaf542e20aac0d4c95477cc2d3c |\ Merge: 20493a7 7b59a16 | | Author: Author | | Date: Mon Jul 11 18:35:09 2011 +1100 | | | | Merge branch 'testfeature' | | | * commit 7b59a16d0b01d9bcc22f21a3c68f63acf60f37da | | Author: Author | | Date: Mon Jul 11 18:34:34 2011 +1100 | | | | Added line to test.file | | | * commit 20ea105cf300f7f3e952ac7eddffd2aee6811f7c |/ Author: Author | Date: Mon Jul 11 18:32:27 2011 +1100 | | Added code for testfeature | * commit 20493a7a61705967b092780cae9fadd76ec49019 Author: Author Date: Mon Jul 11 18:25:17 2011 +1100 

but mercurial does not allow this

 user@host :/tmp/hgtest$ hg merge feature abort: nothing to merge (use 'hg update' or check 'hg heads') user@host :/tmp/hgtest$ 

I want to reproduce the git approach, since it allows you to break up a giant line of development, which combines in bundles related to the functions of commits, makes it easier to understand history.

If I can achieve this behavior using a different method, feel free to share it with me.

+4
source share
1 answer

I think you can say something.

Mercurial does not have a fast-forward merge in terms of git. This is what it tells you: there is nothing to merge, instead you should have an hg update feature . But this will not lead to moving the main bookmark to where you want (and it will also change your current bookmark).

This basically forces you to hg bookmark -f main immediately after the upgrade, which seems wrong.

I will take this to the mercurial-devel mailing list to find out what others think and update this answer as soon as I get the news.

+5
source

All Articles