Replicate a foreign Subversion repository

If you want to replicate/mirror an existing repository which you do not own (i. e. svnadmin dump cannot be used), you can use the svnsync command.

At first: Create a new and empty destination repository on your server:

svnadmin create mirror

Next, create a so called “pre-revprop-change hook script”. This is needed for the subsequent steps.

nano /srv/subversion/mirror/hooks/pre-revprop-change
!/bin/sh
USER="$3"
if [ "$USER" = "yolo" ]; then exit 0; fi
echo "Only the syncuser user may change revision properties" >&2
exit 1

This limits the synchronizing mechanism to the specified user and is executed by Subversion automatically.

Now, initialize and perform the synchronization of the repositories:

svnsync init svn://YOUR_HOST/mirror/ SOURCE_REPOSITORY
svnsync sync svn://YOUR_HOST/mirror/

If the process comes to a halt, you can abort it using Ctrl+C and restart it without breaking anything. The process will continue were it was aborted (as everything is versioned this is not a problem).

For details: Chapter “Replication with svnsync” in the Subversion book.