Search code examples
svngitmergepatchtransplant

How to transplant patches in svn


I used to use git to port features between different branches, rebase, rebase --onto, cherry-pick are typical tools I used. But now I have to work with svn. I don't like to use svn's built in merge command, cause it will combine all the commits into one "merge commit", though with some history traceability after 1.5. Say if I have a range of commits from r100 to r110 in branchA, now I want to port this feature to branchB and branchC by replaying these commits one by one with the same commit comment (resolve any conflicts in between). Is there any automatic tool which can do this for me?


Solution

  • I don't know of any automated tool to do this, but you could implement one along the same lines of git rebase. All it does it make a temporary directory and use git format-patch to to extract the changes you want to rebase and then git am to apply them back to the target root. If you type locate git-rebase on your system you can read it -- it's a shell script. It's probably /usr/local/libexec/git-core/git-rebase.

    The svn equivalent would use svn diff and svn log to save the original commit information followed by patch and svn commit.