Graft vs. Transplant
Solution 1
Graft uses Mercurial internal merging, while transplant relies on patch mechanism. Therefore graft should be able to handle three-way-merges better than transplant currently does.
Solution 2
From the documentation of hg graft it looks like opposite to the transplant extension graft only handles branches within the same repository but can't handle different repositories.
Lars Tackmann
Founder of Solvr - Math and Computer fanatic. I have a passion for mathematics, programming langauges and their compilers. Currently I do most of my work in Dart, C# and JavaScript. I am also trying to get into Scala. In my former life I programmed allot in Java, Ruby (Rails), Perl and C. You can also find me on twitter and linkedin
Updated on June 13, 2022Comments
-
Lars Tackmann about 2 years
The release announcement for Mercurial 2.0 mentions a new graft command, which on first sight looks similar to the transplant extension. What is the difference between these two? Does cherry picking with graft solve any problems that existed with transplant, and if so, what are these?
-
Laurens Holst over 12 yearsGraft is basically
transplant
redone as a core feature. The transplant extension should not be needed anymore. -
Jürgen A. Erhard over 12 yearsExcept graft seems to not support an interactive mode like transplant did? Not tested, just from reading docs.
-
voithos over 12 years@LaurensHolst:
graft
doesn't seem to be able to copy a change from a completely separate repository, whereastransplant
can, using a command-line switch. -
David over 11 yearsNote that you can merge to a repository, graft, and then prune the undesired branch to effectively graft between repositories. I just did this and I got what I wanted.
-
Eamon Nerbonne over 11 years@David: but if you're doing all that, why not just manually apply the patch instead? It's not like you're getting any advantages merging since you can't merge external things anyhow.
-
David over 11 years@EamonNerbonne: Graft preserves some properties of the original changeset (date, long hash) and at least with TortoiseHg allows me to graft multiple changesets with a single command.
-
Eamon Nerbonne over 11 years@David: fair enough. I'm pretty sure you can import multiple patches simultaneously otherwise too. However, graft cannot preserve the hash (no method can) since that also depends on the parent, which has changed. I guess there's a common theme in hg (and git), which is that there are lots of ways to do something, and it's not very important which you pick. Graft is just yet another tool to play with your patches.
-
David over 11 years@EamonNerbonne: Sorry, I'll clarify: it preserves the original hash in an extra field which TortoiseHg also conveniently displays. I think Mercurial internally uses this field to prevent re-grafting the same changeset in the future.
-
Eamon Nerbonne over 11 yearsOh yeah, that's quite handy :-)