hg transplant

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 :-)