Backup a SourceForge hosted SVN repository – sf-svn-backup

SourceForge urges their users to backup the code repositories of their projects. As I have several projects hosted with SourceForge, I should do it too. Making the backups isn’t complicated at all, but because it isn’t automated properly, I’ve been lazy with it.

sf-svn-backup was written in order to simply automate the process. The script is pretty simple to use, just pass as the first argument the project name and the script will write down to stdout the dump file.

For example:

sf-svn-backup openyahtzee > openyahtzee.dump

The project name should be it’s UNIX name (e.g. openyahtzee and not Open Yahtzee). Because the script writes the dump file directly to stdout it’s easy to pipe the output first through a compression program such as gzip to create compressed SVN dump files.

7 thoughts on “Backup a SourceForge hosted SVN repository – sf-svn-backup

  1. Hi Guy, I used your script and is apparently working well, I get a list of all the projects revision in the console and a file. I just have a question. How do you restore the dump file?

  2. To restore the dump file to a local repository you use

    svnadmin load /path/to/repo < dumpfile See $ svnadmin help load for more details. If you want to restore the repository to SF, as project administrator you have an option to import a dumpfile.

  3. Thank you very much. I appreciate your script. The dump-restore procedure worked well for me. I have not tried to restore to SF but I’m sure you have. (Ubuntu 9.04 64bit)

  4. Hehe, this script is sheer beauty – I was wondering how you’d done it, cos I was thinking it’d be something tricky with the ssh shell etc and stuff like that.

    rsync + svnadmin dump. beautiful.

    I stole the rsync bit and dumped it into a script of my own actually, I’m in the process of switching away from subversion to git, and I’ve always found sourceforge’s subversion hosting to be really slow anyway. I’m using it to move one of my really old projects over to github, one that’s been sat doing nothing for (looks like) three years now.

    I’ll post my version of the script when I’ve finalised it

  5. On Mac OS X 10.10, it was necessary to adjust the syntax for tmpfile.

    Change line 87 from:
    TEMPDIR=mktemp -d
    TEMPDIR=mktemp -d -t sf-svn-backup-XXXX

    and everything runs nicely.

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.