ItecSoftware Logo

Moving a Subversion Repository

Written by Peter Gilg on - like this:
subversion repository

At some point in a developers life, we have to upgrade, switch hosting providers or replace broken hardware and with that comes the inevitable. Moving all of our apps, data and configuration settings, and eventually our holy repository. And with that comes also the task of moving a subversion repository.

Moving an SVN repository from one Subversion server to another, while carrying over the entire version history information may seem like a daunting task, but fortunately it’s rather quite easy and straight forward.

Backup your old Repository

Step one is the generate a dump file of the existing repository which we can later move to our new server.
We create this dump with the following command:

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

This dump file contains now all the revisions that have ever been made and committed to our SVN repository, and therefore this file may get rather large, depending on how active and old the repository is.

Create the new Repository and move the dump file

Now let’s create a new repository on our new server:

# svnadmin create /path/to/new/repository

then we simply transfer the dump file to our new subversion server.

Import the dump file

And finally import our dump file with the force-uuid flag:

# svnadmin load --force-uuid /path/to/new/repository < repository.svn_dump

The force-uuid flag retains the UUID and keeps the repo’s integrity in check. And that concludes the basic steps of moving a subversion repository.

Note

You also have the option to  import a partial dump, by creating an incremental dump starting at a revision number of your choice, like such:

# svnadmin dump --incremental -r 456789 /path/to/old/repository > repository_r456789.svn_dump

and then import it on your target server:

# svnadmin load /path/to/new/repository < repository_r456789.svn_dump

SVN dumps should also be part of your repository backup strategy. Keep them on a separate server so they’re ready for restoration should your Subversion server take a dive, and they work nicely across different versions of subversion.

Listed in Useful Stuff, Web Development

Tags: repository, subversion, svn

Leave a Reply

Your email address will not be published. Required fields are marked *