Tuesday, September 02, 2008

Splitting an SVN repository

Griv, now renamed to Galapix due to naming conflict with another project, is currently sitting in the Windstille repository, however since the project has grown 'big enough' it shall now get its own repository. Trouble is, how does one split a repository? The official docu is a little lacking and svndumpfilter doesn't look like the most solid tool either, so a little trickery was involved and here a little howto.

First get yourself an up to date dump of your SVN repository, if you have it local, its just a 'svnadmin dump repo/' command, if you have it remote you have to make sure that the backup you download is actually up to date, since the dumps are only updated once a day on most public hosting services. Simply grep for "Revision-number:" and compare it to whatever svn tells you about the repository.

Next step is to filter the repository, in my case it was done via a:

svndumpfilter include --drop-empty-revs --renumber-revs trunk/griv trunk/griv-old branches/griv-sdl

So far everything according to plan, trouble now however is that the import of the dump will fail, since the trunk/ and branches/ directories are required for the dump to function but not actually included in the dump. The fix for this is simply creating them:

svnadmin create galapix
svn co file:///tmp/galapix galapix-checkout
svn mkdir galapix-checkout/trunk/ galapix-checkout/branches/ galapix-checkout/tags
svn commit -m "Core directory structures created" galapix-checkout/

With the missing directories in place one can now load the dump:

svnadmin load galapix

Once the load is complete, you can update the checkout and everything should be back normal.

In the case of Galapix the very final step was now to upload the repository to googlecode.com, instructions for that can be found on their help pages, but a little word of warning "svnsync" is incredible slow and interrupts a lot. I had to do a 'while true; do svnsync ...; done' loop to get it done and that is actually quite shocking since Galapix is tiny, just 170 revisions and a repository size of just 2.5MB and yet svnsync is running now for a good hour taking half a minute per revision. I really wouldn't want to repeat this process with anything larger (complete Windstille is a few thousand commits and close to 1GB in size...).

The final repository can be found at:

svn co http://galapix.googlecode.com/svn/trunk/galapix

No comments: