How to move a Subversion Repository to Another Server

Moving a subversion repository from one server to another, while still preserving all your version history may seam like a daunting task, but fortunately it’s not too difficult.

1. Backup your old repository

The first thing you need when moving from one server to another is a dump of your subversion repository. Hopefully you are already creating dump’s with a backup script, but if not here’s how you can create a subversion dump file:

# svnadmin dump /path/to/repository > repo_name.svn_dump

The dump file contains all the revisions you have ever made to your svn repository, so it will probably be quite large (it even includes files you may have deleted in a previous revision).

2. Create the new repository on the new server

Follow https://injustfiveminutes.wordpress.com/2013/01/24/how-to-install-subversion-on-centos-6-x/

3. Import your old repository into the new one

Import your dump file:

# svnadmin load /path/to/repository < repo_name.svn_dump

You may want to force subversion to use the same UUID for the new repository as the old repository. To do this add --force-uuid to your svnadmin load command. In my case I wanted to do this. If you have already loaded your repository, there is a way to set the UUID at a later date, check the docs.

That’s it, you now have a replica of your old repository on your new server.

4. Switch your current code project to the new server

Finally you will need to tell your current code project to start working with the new server which will commonly have a new URL.

Go to your project’s root directory:

project# svn switch --relocate svn://<old hostname or ip>/<repo name>/project  svn://<new hostname or ip>/<repo name>/project .

This won’t output any messages if successful.

Advertisements

One thought on “How to move a Subversion Repository to Another Server

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s