This is how to move a Subversion repository from one place to another. It’s one of those operations I undertake only infrequently, and so have to re-learn each time. This time, I’m writing it down. In this example, I’m converting a file-based repository to a server-hosted one.
- Make sure your working directory is fully checked-in to subversion, and back it up, just in case.
- Dump the subversion repository. This is done with an svnadmin command:
It will show progress as it dumps each revision to the dumpfile.
svnadmin dump c:\svn\foobar | gzip -9 - > foobar.dump.gz
- Create the new subversion repository, however it is that you usually do that. In my case, I use the Subversion control panel at Dreamhost.
- Copy the foobar.dump.gz file up to the server.
- Load the dumpfile into the new repository:
It will show even more verbose progress than dump did, as it rebuilds the repository transaction by transaction.
zcat foobar.dump.gz | svnadmin load foobar
- Checkout the new repository to a scratch directory:
svn co http://svn.whatever.com/foobar
- Examine the new scratch directory and your current working directory. Make sure the files are the same, to check that the right content is correctly ensconced in your new repository.
- If all is well, you can switch your working directory to the new repository:
svn switch --relocate file:///c:/svn/foobar http://svn.whatever.com/foobar
Enjoy your new repo.