Sync Subversion between two different servers

I had a need to back up my repo to another server. I already back up the repository to an external dive but i thought this would be an even better solution. To have a hot backup!

After searching google for a wile i found a article that fit the bill.
https://journal.paul.querna.org/articles/2006/09/14/using-svnsync/

While i have version 1.6.11 it still worked great!

The only thing that i did differently was create a user in the repo to run this as.

So, to make this easier, I am going to put the repository URIs into environment variables:


$ export FROMREPO=svn://svn.example.com/
$ export TOREPO=svn://dest.example.com/

Because the svnsync is allowed to rewrite anything on the TOREPO, we need to make sure the commit hooks are configured to allow our 'svnsync' user to do anything it wants.

On the server hosting TOREPO, I ran this:

$ echo "#!/bin/sh" > hooks/pre-revprop-change
$ chmod 755 hooks/pre-revprop-change

Now we are ready to setup the sync:

$ svnsync init ${TOREPO} ${FROMREPO}

This will prompt you for the username, password, and also sets several revision properties on the $TOREPO, for revision zero. It doesn't actually copy any of the data yet. To list the properties that it created, run:

$ svn proplist --revprop -r 0 ${TOREPO}

svn:sync-from-uuid
svn:sync-last-merged-rev
svn:date
svn:sync-from-url

$ svn propget svn:sync-from-url --revprop -r 0 ${TOREPO}

svn://svn.example.com/

So all the knowledge about what we are syncing from is stored at the destination repository. No state about this sync is stored in the source repository.

We are now ready to begin copying data:


$ svnsync --non-interactive sync ${TOREPO}