Importing from SVN

21 Jan 2009
Tags: VitaminSEE, git, and svn

Importing a SVN repository into git is a utter pain if you have anything nonstandard.

A note to everyone out there in the world who came here through google: In git-svn, there is a function called sub do_git_commit. If you have an svn branch that isn’t getting merged in correctly, make a local copy of git-svn and hack that function. There’s a foreach loop where you’re adding ‘-p’ options. Immediately afterwards, hack it to add more parent commits on certain revisions.

So in my case, r149 was supposed to be a merge point. I found the hash of the commit that should have been one of the parents and wrote:

if ($lr == 148) {
  push @exec, '-p', "a8ef9cf2314224558fe205baca770d2a8df556b9";
}

This worked for me. This probably would have been amazingly harder if I had more than one of these broken merges since it would probably change a lot of the commit hashes. YMMV.