Mercurial - Is it possible to merge changes from the trunk to a branch, within the same repository?
If yes, is it possible with TortoiseHg?
Mercurial - Is it possible to merge changes from the trunk to a branch, within the same repository?
If yes, is it possible with TortoiseHg?
There are two things you can do, merge or transplant. These answers assume the command line, you may have to search through your menus in tortoise to find similar functionality.
You can merge all the changes from one branch to another. The procedure for this is:
hg update mybranch
hg merge default
hg commit -m "Merging with default"
This will bring all commits from default into your branch, but not the other way around. Later you can reintegrate your branch with default by doing the opposite
hg update default
hg merge mybranch
hg commit -m "Bringing in changes from mybranch"
If you want to bring in one or more specific commits that were committed in another branch, you can do that with 'transplant', which is a mercurial extension.
# reqiured in ~/.hgrc
[extensions]
transplant =
These are the commands you can use to use transplant:
hg log | less
# (find revision number, the part after the colon, i.e. "88660cca467d")
hg update mybranch
hg transplant 88660cca467d
# (no commit required)
As @Jerub said, you can use merge and transplant to get change sets from one branch to another. With TortoiseHg you can do a merge by opening the "repository explorer", then select the first revision to merge, and afterwards right click on the second revision to merge. Chose the "Merge with..." menu item to do the merge.