Using svnsync to migrate an SVN repository to another site
By Ari Shamash on Jul 07, 2009
I recently had to migrate our SVN repository from one SVN service to another. Normally, this is done via svnadmin dump and svnadmin load, but I did not have administrative command line access to one of the environments, so I had to use the svnsync tool to accomplish this. Took me a while to figure out how to do it, and naturally and I didn't write it down, so when I had to do this the second time around, I forced myself to blog it, so when I had to do it the third time, I woul dhave some reference material. This blog entry really has little to do with sharing with you (the reader), but rather sharing with "future me" ;-)
Anyway, the tool to use is svnsync, but the docs are a bit sparce. Mirroring the repository is a two step process.
- First, the destination repository has to be set up via the svnsync init command, which confusingly takes the DESTINATION repository URL argument before the SOURCE repository URL (this one stumped for a while):
svnsync init --sync-username username --sync-password password DEST_REPOSITORY_URL SRC_REPOSITORY_URL
- Once the destination repository is set up, you can use the svnsync sync command to initiate the copy. In case the sync fails (e.g. due to network failures), this command can be restarted as frequently as necessary to copy the entire repository. The primary use of svnsync is to create mirrors, so some folks even run this out of cron to periodically sync the repositories:
svnsync sync --sync-username username --sync-password password DEST_REPOSITORY_URL