Back Up a SourceForge-Hosted SVN Repository – sf-svn-backup

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

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

For example:

sf-svn-backup openyahtzee > openyahtzee.dump

The project name should be its 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 through a compression program such as gzip to create compressed SVN dump files.

7 thoughts on “Back Up 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 sf.net 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
    to:
    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 *