Mon 13th Apr 2015 at 14:31

Moving a subversion repository to a different address/server

The documentation for moving a repository to a new server is very clear. It tells you that you should:

svnadmin dump /path/to/repository > repository-name.dmp

and then use the following on the new server:

svnadmin create repository-name
svnadmin load repository-name< repository-name.dmp

This is the recommended route for a lot of repositories and I would urge you to stick to it. If, however, you can guarentee that no one will be working on the repository, you can opt for the simpler method of just copying it over to the new server.

The biggest problem that I faced when I recently had to move a repository from one server to a new home on a completely different server was what to do with my working copies. I simply did not want to have to delete the checked out copies and start again as I use svn to maintain some live websites.

The solution, it seems, is quite simple (be it undocumented)...

Firstly, back everything up. I can not stress this enough and then test the new home of you repository works. Try checking out to a fresh location.

Finally, for each working copy of the repository, execute the following

grep -rl <old_src_address> /root/of/working/copy | awk '{print "sed -i -- "s/<old_src_address>/<new_src_address>/g" ""$0"""}' | sh

That's it. The advantage to this method is that it is far quicker if you have multiple working copies of a repository.

Unfortunately, this will only work on *nix systems (this include OSX)

This site uses cookies, please read my cookie policy.