If you have ever had to move svn from one server to another, you were probably given a svndump file that contains all revision history. If you are like me, you favor a GUI over command-line. Unfortunately, most GUIs don’t support a load or restore. So for ease of future reference, here is how to restore from a svndump file (sometimes called an svn export).
First step. Fire up terminal.
Note: You can find all of this info in the book Version Control with Subversion at http://svnbook.red-bean.com/
Get the svndump
You’ll probably get a svndump file from your svn host. If you already have the file you can skip this section.
If you need to create a svndump file you can do so with
svnadmin dump. If you type the following into terminal, you’ll create the file repo.svndump. This file will contain a dump of your entire repository history.
$ svnadmin dump /path/to/repo > repo.svndump
$svnadmin dump /www/repos/helloworld > helloworld.svndump
Create a new empty repository
In order to restore the repository that was just dumped, you need to create a new empty repository. Here you’ve got a couple of options. Most svn GUI clients allow you to create a new repository. You can either go that route, or create the new repository via the command-line like so.
$ svnadmin create /path/to/new/repository
$ svnadmin create /www/helloworld
Load (restore) the svndump
Once you’ve got a new empty repository, you can load the svndump file. Here’s where most svn GUI clients let you down. In most cases, your only option is command-line.
$ svnadmin load /path/to/new/repository < /path/to/svndump
$ svnadmin load /www/helloworld < /temp/helloworld.svndump
Let that run until you see the command prompt again, and your new repository will be fully loaded.
Sync with a remote repository
If you need to restore to a new remote repository, you will need to use svnsync. I have only had success with this if the remote repository is new (empty). Here is the command-line sync.
$ svnsync init --username YOUR_REMOTE_REPO_USERNAME REMOTE_URL SOURCE
$ svnsync sync --username YOUR_REMOTE_REPO_USERNAME REMOTE_URL
$ svnsync init --username troyweb http://mysvnhost.com/helloworld file:///www/helloworld
$ svnsync sync --username troyweb http://mysvnhost.com/helloworld