I just switched over from SVN where after a few changes to the trunk I would merge a range of revisions (from my last merge from the trunk to the branhc - HEAD) into a branch. I want to do the same with Mercurial using TortoiseHG but I can't figure out how. I just committed two changesets to the trunk, now I need the branch to integrate those changes. Thanks in advance!
In hg (or any DVCS) you can merge any changeset with any other changeset (except ancestors). If you open repository log from TortoiseHG (View Changelog from Explorer context menu or hgtk log
from command line), you can update to any changeset, then select "merge with".
In your specific case you would update to your branch head, then merge with trunk head.
This is what I typically do:
hg up trunk #assuming trunk is your main branch
hg merge -r myawesomebranch
#party
I've written a guide about working with branches in Mercurial. It boils down to this:
$ hg update mybranch # unless you are already at the tip of the branch
$ hg merge default # merge in latest changes from "trunk"
$ hg commit -m 'Merge with default'
When mybranch
is done, you close it and merge it into default:
$ hg commit --close-branch -m 'Ready for merge'
$ hg update default
$ hg merge mybranch
$ hg commit -m 'Integrated mybranch'
The cool thing about Mercurial is that you use the same commands no matter which direction you are merging. Subversion's merge tracking system requires you to add special command line flags when you merge in one direction, but not in the other (I cannot remember which direction is which without looking it up in the manual).