This is kind of a rambling post since I’m writing this on-the-fly at 11:00 PM.
In preparation for the release of ML# (ML-Sharp), I’ve begun moving things over to Google Code. ML# has a very long Subversion history with over 300 commits in the last year. I could have just nuked all that history, but I really wanted to preserve it just in-case I ever wanted to go back and look at something one day. So, just copying the current revision into Google Code was out of the question. Here’s what I did to migrate the project.
Isolate the projects to be migrated
The original SVN repository contained everything: code, data, the works. It wasn’t anything sensitive, but it was data that wasn’t really needed anymore, and I didn’t want to copy it. So, I followed this procedure to filter the repository down to just what I wanted to migrate. Unfortunately, I did some renames/moves early in the project, and the original files were in paths that were outside the path I wanted to migrate, which means that svndumpfilter won’t work; it fails with the lovely “Invalid copy source path” error. A bit of digging revealed this python script which claimed to overcome this limitation in svndumpfilter. It did not work for me, it died every time with a cryptic error. Lovely. So instead, I manually excluded the folders and directories I didn’t want to include. That *seems* to have done the trick.
Next, I created a new, empty repository on my local server, and loaded the dump using svnadmin load. Next, I re-organized this new repository so that it’s structure matched my desired structure. At this point, I was ready to begin migrating the repository to Google Code.
First, I went to the source control page for my project on Google Code. At the bottom, there was a link that I clicked to reset the repository to revision 0. This step is necessary if you’re going to use svnsync to migrate an existing repository (which is exactly what I was doing).
Next, I ran svnsync. When prompted for your Google code credentials, be sure to use your GoogleCode.com username and password, not your regular Gmail credentials. If you get an error that says “DAV request failed” and “pre-revprop-change hook either failed or is non-existent”, be sure you have a pre-revprop-change hook defined (the hook can be empty). Also, if you get authentication errors, make sure you are using https and not http to connect to your Google Code repository. That mistake cost me about 15 minutes.
Once you’ve initialized svnsync, just fire up the actual sync process, sit back, and wait (for a really long time, in my case). Once svnsync finishes, you should find that all your code has been mirrored on your Google Code repository.