Reputation: 25339
I am trying to use Mercurial and I want to reproduce git branching model with help of Bookmark extension. Here is the problem with that.
Imagine I have a repostory. I've 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've commited some code and decided that feature is ready (no development on this feature in near future). At this moment bookmarks point to different commits.
user@host:/tmp/hgtest$ hg bookmarks
* feature 2:9d32bb6bdbc6
main 0:76c6736b4548
Now i am switching back to the state where i've started development of my feature
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 merge
command in order to make history graph looking like this
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 doesn't 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 git approach since it allows to break giant line of development commits into bunches of feature related commits, make it easier to understand history.
If I can achieve such behaviour using another technique please feel free to share it with me.
Upvotes: 4
Views: 342
Reputation: 20881
I think you might be on to something.
Mercurial doesn't have "fast-forward" merges, in git terms. This is what it's telling you: there's nothing to merge, you should hg update feature
instead. But that won't move your main
bookmark to where you want it to be (and it will also change your current bookmark).
That basically forces you to hg bookmark -f main
right after updating, which doesn't seem right.
I'll take this up to mercurial-devel mailing list to see what the rest think and update this answer once I have some news.
Upvotes: 5