开发者

In mercurial, is there a way to merge during transplant?

It seems like what transplant does is to make a patch out of the changeset(s) and apply it on top开发者_如何转开发 of the target, similar to qimport -r then qpush.

Therefore when some hunks fail to apply, you'd get reject files and have to "fix up the merge" manually.

Is there a way to run visual merge similar to rebase?

Needless to say, I have to use transplant instead of rebase because I don't want to include all descendant changesets, i.e. I'm cherry picking.

I'll post a self-answer that I have in mind, but I wonder if there's an easy/better way.


This self-answer doesn't actually use transplant at all. The idea is to merge as usual, then revert to the merge and commit.

hg init trans
cd trans
echo 1 > file
hg ci -A -m c1

echo 2 >> file
hg ci -A -m c2

hg up -r0
echo 3 >> file
hg ci -A -m c3

hg merge 1
hg ci -m merge

hg up -r1
hg revert --all -r3
hg ci -m "c3 transplant"
hg strip 3

At the end, changeset c3 is "safely" transplanted onto c2.

Another nice thing about this approach is that when I do revert, I can choose only the files I want.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜