views:

181

answers:

4

If I have some files that are especially important, can they be SVN committed to two repositories?

I can set up two SVN repositories on 2 different machines so that if there is problem with one machine, then there is always a back up.

(will be best if it can be Tortoise or command line). thanks.

+6  A: 

You can use svnsync on the server to create a mirror of your original repository.

More info: http://svn.collab.net/repos/svn/trunk/notes/svnsync.txt

Philippe Leybaert
+1  A: 

Well, you could use a post-commit-hook and commit the whole repository (or just the important files) to another repository. This will take away the pain of remembering to commit everything to two repositories and is an elegant solution.

pmr
+1  A: 

Extending from activa's idea (using svnsync), you could get svnsync to run after each commit by triggering it in an SVN hook script, for example, post-commit. This way, after each commit, your secondary copy would be synchronised with your primary copy, thereby always keeping your backup up to date.

Daniel Chambers
+1  A: 

If you're worried about losing repository data, then doing automated backups is a possible solution. The "svnadmin dump" command is ideal for that.

I use this script to create dumps of all my repositories:

#!/bin/bash

DATE=`date "+%F"`
BACKUPDIR=/var/backup

# dump subversion repos.
# all subversion projects are in /usr/local/svn
for REPODIR in /usr/local/svn/*
do
    REPONAME=`basename $REPODIR`
    TARGET=svndump-$REPONAME-$DATE.gz
    echo backing up svn repository $REPODIR to $TARGET
    svnadmin dump $REPODIR | gzip > $BACKUPDIR/$TARGET || exit 1
done

This script is run from a cron job. You can add an rsync command to copy these dumps to a different server.

amarillion