Question On Transplant Extension

Greg Ward greg-hg at gerg.ca
Wed Jul 8 19:11:41 CDT 2009


On Wed, Jul 8, 2009 at 3:56 AM, Carlo Camerino<carlo.camerino at gmail.com> wrote:
> apply changeset? [ynmpcq?]: c
> applying 6aae7d87a9c2
> patching file pom.xml
> Hunk #1 FAILED at 9
> 1 out of 1 hunks FAILED -- saving rejects to file pom.xml.rej
> patch failed to apply
> abort: Fix up the merge and run hg transplant --continue
>
> i keep on getting this error,
>
> what can i do to resolve this?
> it says hunk #1 failed.

I think the fundamental problem here is that 'transplant' does a 2-way
merge, just like the good old-fashioned 'patch' command line tool.  So
it uses the same conventions as 'patch'.  If you've ever dealt with
Unix diff and patch, you'll know about .orig and .rej files.  If not,
well, it's time to learn.

What you have to do is resolve the conflict.  You do that by loading
the file-being-patched (pom.xml) into your editor alongside
pom.xml.rej.  For each patch hunk in pom.xml.rej, figure out 1) if
it's still relevant in pom.xml and 2) if so, apply it manually by
editing pom.xml.

This is one of the disadvantages of transplanting changes rather than
merging them.

(Hmmm: patch only does a 2-way merge because that's all it can do,
i.e. it has no idea what the common ancestor of the two versions is.
But can transplant do better?  I.e. can't it compute the common
ancestor of the transplant source and target and use it to do a 3-way
merge?  That would also mean it could use Hg's regular merge
machinery, with nice GUIs and everything.)

Greg


More information about the Mercurial mailing list