Wednesday, July 7, 2010

Migrating from svn to git

Several tutorials have already documented the necessary steps for the conversion from svn to git (, so I won't reiterate any of that. What made our migration tricky were two things:
  1. SVN commits without authors
  2. No tags, branches, or trunk paths
The second was easy to fix actually. I didn't specify any flags for standard layout or tags/branches in the git svn clone command. The second took a little bit of guess work. Before I begin, I'll point out that I used the script (after cleaning up the leading and trailing white space)

svn -q log | grep ^r | cut -d '|' -f 2 | sort | uniq > authors.txt

as conveniently provided in the comments to one of the tutorials. Just to make life easy, I used the following VI macro to fill out the definitions in the file,

yeA= ^[pa <^[>^[j0

I noticed a blank line in the file, which was generated because of commits to the repo with no user name -- literally just the empty string. Big deal, I just removed it. When I tried to run the "git svn clone" though, it puked when it got to those revisions:

$>git svn clone svn://svn.domain/project -A authors.txt
Author: (no author) not defined in authors.txt file

I googled and found a support article,, which didn't actually solve the problem, just avoided it. It turned out the fix was actually easier than I thought. I added the following line to the authors file:

(no author) = no_author

1 comment:

  1. Just in case some one needs it, in my case I had to add also the email. Something like:
    (no author) = no_author