I'm new to mercurial and I'm trying to do something really simple but can't figure out how to. I created a branch to do some experimentation without disturbing the main branch.
trunk A -- B -- C
\
experiment D -- E -- F
I like how the experiment went and want to merge it with trunk and get
trunk A -- B -- C -- D -- E -- F
However, since nothing was changed in the 'trunk' branch, the merge says that there is nothing to merge, which is fair enough. I just need to end up one branch called 'trunk'. How can I do that?
Merging in Mercurial always work the following way:
For instance, in your case, you would do:
hg update trunk
hg merge experiment
There are some things to consider when picking which branch to update to, and which to merge from, and it has to do with bookmarks and branch names.
Take branch names first. If you first update to the trunk branch, then merge with experiment, the merge changeset will be on the trunk branch.
However, if you update to the experiment branch, merge with trunk, then the merge changeset will be on the experiment branch.
This is important to consider when thinking about why you're merging. Are you merging the experiment into trunk, or are you updating the experiment with other changes having occured on trunk.
As for bookmarks, with newer versions of Mercurial, bookmarks are an integral part, and if you update to a bookmark, say like this:
hg update moving-target
and then commit, that bookmark will follow your commit, ie. it will move forward.
In line of this, if you have a bookmark called moving-target on the head of the trunk branch, and update to that bookmark, the merge changeset, when you commit it, will move that bookmark forward.