Mercurial: Any ideas on how to skip some changeset

2019-06-21 11:52发布

问题:

Here our situation: We have two branches in our Mercurial repository lets call them Branch A and Branch B.

  • Branch A is for the stable version of the code
  • Branch B is for the development branch

Everything that was modified in branch A has been merged to branch B. However now we came to a point where the code in branch B has several differences from branch A. We made some large code changes in branch A, merging these changes in branch B would be a real pain and actually we would like to make an alternative implementation of the solution. However later we would also like to continue the changes on branch A and still be able to merge these later minor changes into branch B. So the question is: Is it possible to skip some single changesets from branch A when merging into branch B and merge later changesets from A into B again? (Possibly with a pure Hg solution and no workarounds, with copies from backups and so on...)

Here an overview of what we would reach:

    Changesets Branch A     Changesets Branch B
    Chgset A.1              Chgset B.1 (Merged with A.1)
    Chgset A.2
                            Chgset B.2 (**Not merged with A.2**)
    Chgset A.3              Chgset B.3 (Merged with A.3 but not with A.2)

Thanks in advance for any advices

回答1:

This is the exact purpose of the transplant extension.

The transplant extension (cherry-picking in other DVCS) keep tracks of what comes from where when you copy change sets, so merge is easier.

You have to activate the extension first (it is included but disabled by default). In your hgrc file, add:

[extensions]
transplant=