Posts Tagged ‘SVN’

How to restore from svndump (or svn export)

Written by Perry Woodin on . Posted in Misc Ramblings

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

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 sync --username YOUR_REMOTE_REPO_USERNAME REMOTE_URL

$ svnsync init --username troyweb file:///www/helloworld
$ svnsync sync --username troyweb

SVN obstructed? How to remove all .svn folders

Written by Perry Woodin on . Posted in Misc Ramblings

I recently committed a rather large code base to SVN. To my knowledge, the code base had not been in SVN before. Turns out I was wrong. Upon attempting to commit the working copy, I kept seeing directories flagged as “obstructed.” I tried an SVN clean, but that didn’t help.

The problem was a bunch of legacy .svn folders in various directories. My fix was to fire up terminal and delete all of the .svn folders in one fell swoop. Here’s how to do it.

  • Start Terminal.
  • Change directory to your code base. This is really important. Otherwise you could unintentionally delete .svn folders you would rather keep.
    $ cd /Library/WebServer/targetdirectory
  • I like to list, just to make sure I’m in the right place.
    $ ls
  • Find and delete the .svn files
    $ find ./ -name ".svn" | xargs rm -Rf

Done. Now you should be able to commit without issue.