Renaming an SVN(Subversion) Repository

Print

What is SVN?

If you don't know what SVN is and you're reading this page, you probably got here by mistake. That's OK! However, you will probably not benefit much from this tutorial

If you decided to stick around, SVN is document versioning software commonly used by software developers as a repository for source code. Like CVS, GIT and Miscrosoft Source Safe SVN allows multiple users to work on the same file and it keeps track of changes to the files.

If you want to learn more about Subversion visit: subversion.tigris.org

The issue: Renaming a Repository

Here's the scenario: We have an SVN repository and we want to change it's name. The reasoning behind the name-change is irrelevant but most likely the project that is stored in the repository went through a name change.

The problem is that SVN doesn't have a Rename Repository command we could use.

The solution: svnadmin dump & svnadmin load

The correct way to do this is to actually create a repository with the new name, and then import all revisions from the old repository into the newly created one. This way, all the revision history will be preserved

So, first we create a repository with the new name. Assuming /path/to/new/repository/ is the path where you want the new repository to be created, and <new-repo-name> is the new name, the command would look like this..

svnadmin create /path/to/new/repository/<new-repo-name>

Then we dump all the data from the old respository into a file called old-repo.dump. We will assume /the/path/to/old/repository/ is the path to the repository and that the old repository was called old-repo-name.

svnadmin dump /the/path/to/old/repository/<old-repo-name> > old-repo.dump

Now, we can import the dump file into the newly created repository. In order to to that we use the SVN load command.

svnadmin load /the/path/to/new/repository/<new-repo-name> < old-repo.dump

Wrapping up

One thing to note is that for this method to be successfull, the newly created repository has to be empty. Otherwise you may get all sorts of errors and/or funny results.

The other observation that I would make is that in case of a large project, this process may take a while and the resulting dump file and new repository may be rather large.

Design copyright (c) Miky Dinescu