mercurialchangesettransplant

Transplanting into one changeset


I'm trying to move changes from a couple of changesets into one changeset on the other branch. There are other changes in between that I want to skip, so I don't want to simply merge everything.

hg transplant moves the changes correctly, but now I'd like to flatten them into a single commit. How can I do that?


Solution

  • You can fold them by

    1. Backup the repository, a failure during the process can destroy data
    2. transplant the desired changes to the target branch
    3. transform them there into a mercurial queue (hg qimport -r first-to-fold-rev:)
    4. fold them into one patch (hg qpop until the first patch is applied, then hg qfold <<patch name>> the following patches into this one)
    5. Edit the commit message (When there are NO OUTSTANDING CHANGES hg qrefresh -e)
    6. apply the single patch to your repository (hg qfinish -a).
    7. When there are further unfolded patches:
      1. hg qpush until the head patch
      2. hg qfinish -a
      3. Review the new repo state (hg glog/hg incoming)