Over the last few weeks Mike Robinson and I have discussed and decided an SVN restructuring for improving our build and deployment processes. I would encourage you to read a bit more about that (and various other geekness) at his blog.
So I’ve spent this week moving our company hosted SVN from Beanstalk to Springloops. I feel I’ve been swinging between hell and zen, but the learning has been awesome. As a summary of what I’ve found I thought I’d give a quick walk through how I did it.
Most of this stuff was the usual dump/load cycle, but there are a couple of things which needed some extra attention.
Firstly, both Beanstalk and Springloops have the ability to export and import SVN dumps via easy-to-use web interfaces. This really could be as easy as download, upload. Try that first.
We had a couple of problems though. Previously we had a mishmash of company repos and project repos; these had to be merged and sorted. We also had different usernames on each system(!) which meant that during an import previous commits were not matched to current system users. The author attribute needed to be updated for all previous revisions.
This was all done on OS X, but should be applicable to any Unix-like with the appropriate libraries, etc. So we’ve got our dump from Beanstalk, now we just need to create a local repository to do our work on (always work on a backup!!).
$ svnadmin create --pre-1.4-compatible newrepo
We use the pre 1.4 compatible flag to overcome files system changes within SVN between versions. These changes can potentially cause errors (svn: Expected FS format ’2′; found format ’3′) when propset-ting revision histories, in my case, author/committer names.
Next job, import your dump file.
$ svnadmin load newrepo < dumpfile
If you’re looking to do the merging, as I was, then you want to make yourself a directory in your repository (usual ‘svn mkdir’ commands) and then load it in the following fashion:
$ svnadmin load newrepo --parent-dir myfolder < seconddumpfile
Ok, we’ve done our merging, now we’re going to update our author histories. Now the SVN manual gives you information on doing this one version at a time with a propset. It also talks about other recursive actions such as deleting files, which isn’t our concern. For changing authors, I found a tidy script called svn-author-tweak.py from CollabNet.
If you want to give your repository a check before you upload it, just checkout to a local test.
$ svn co file:///path/to/newrepo /path/to/test/repo
Once that’s done, dump the file.
$ svnadmin dump newrepo > my.dumpfile