Officially, you cannot. Mercurial has no formal supports for partial merges and cherrypicking.
Actually, there are a few history editors that let you select thunks to apply. Plus, I have not yet really tried out mq, the quilt extension. So far my experience with Mercurial history editing tools is hit and miss, mainly miss. They mostly fail in the presence of merges, anything other than a simple linear divergence.
But you can do much by hand.
You can "cherry pick" individual files by using hg revert:
hg diff -r branch1 -r branch2
// look at diffs, figure out files that can be moved independently
hg update -r branch1
hg revert -r branch2 file1 file2
// test and then
hg ci
I find the name "hg revert" very strangely named. I think of revert as going back to an earlier version, going backwards, not makuing progress. But once you get past this, ok.
Merging changes in the midle of a file, interleaved with other changes, is more of a pain. Basically, edit the diff to create a patch file. Various tools can help.
The biggest problem with fdoing this by hand is that Mercurial does not really understand that you have done a partial merge. It is not recorded in the history. Revsets exprssions cannot be used to look at the ancestors or merges.
No comments:
Post a Comment