Graft vs. Transplant

18,729

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.

Share:
18,729
Lars Tackmann
Author by

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, 2022

Comments

  • Lars Tackmann
    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
    Laurens Holst over 12 years
    Graft is basically transplant redone as a core feature. The transplant extension should not be needed anymore.
  • Jürgen A. Erhard
    Jürgen A. Erhard over 12 years
    Except graft seems to not support an interactive mode like transplant did? Not tested, just from reading docs.
  • voithos
    voithos over 12 years
    @LaurensHolst: graft doesn't seem to be able to copy a change from a completely separate repository, whereas transplant can, using a command-line switch.
  • David
    David over 11 years
    Note 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
    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
    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
    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
    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
    Eamon Nerbonne over 11 years
    Oh yeah, that's quite handy :-)