Ever wanted to cherry-pick a set of patches from one Hg branch to another one, even a set which are non-contiguous and are in the middle of the history? You need the Transplant Extension. It ships with Mercurial. Enable it in your ~/.hgrc as explained in the above-linked page. Then:
- Get a working copy of the target branch (e.g. using hg update -C <target branch>)
- hg log -b <source branch> to find the revision numbers of the revisions you want
- hg transplant -b <source branch> REV1 REV2 REV3 REV4
- hg outgoing shows the transplanted changesets
- hg push
It’s that easy :-)
It’s only that easy if you don’t need to change the commit message and that the patches apply cleanly ;-)
I simply do “hg export REV | hg import -“, the result seems to be the same. But you probably need this in your hgrc file:
git = true
Not sure about the current release but Mercurial’s default exports used to contain no data on binary changes, they were also inconsistent about moves for example.
IIRC at one time if you set git=true you could do binary changes but file moves would not work. But if you set git=false, file moves would work but binary changes would go down a black hole. I believe that this is fixed in current versions of Mercurial.