For various reasons, it may be good to have a mirror of a given svn repository (by mirror, I mean a full copy of all the history), for example to have faster access to the history if you have slow connection, or, as in my case, to enable simpler import to other source control systems (bzr, hg, etc…). Subversion comes with a tool, svnsync, but there is not much documentation on it, and the one I found was not accurate, or at least did not work for me. So here are a the exact steps which made it work for me, on Ubuntu (7.10, but I don’t think the version matters as long as you have svnsync and a relatively recent subversion client).
I will assume for the rest of this mini-tutorial that the repository you want to copy is ORIG (which should point to a valid svn repository, for example http://svn.scipy.org/svn/numpy. Note that it must be the repository URL, not trunk or anything), and the one to copy is COPY (this one will be a pathname). The first thing to do is to create a local subversion repository on your machine:
svnadmin create $COPY
Check that you create correctly the repository at the right path:
svn info file://$COPY
Now, create the following hook into the mirror repository: $COPY/hooks/pre-revprop-change, and put the following content into it
#!/bin/sh USER="$3" if [ "$USER" = "svnsync" ]; then exit 0; fi echo "Only the svnsync user can change revprops" >&2 exit 1
This is so that only the svnsync user can modify the revprops, which is necessary for the mirror. The file must be executable:
chmod +x $COPY/hooks/pre-revprop-change
Now, you can initialize the synchronisation (e.g. the mirroring):
svnsync init --username svnsync file://$COPY $ORIG
If successfull, it should tell you something like ” Copied properties for revision 0″. You can now start the mirroring (which will take time, depending on your network connection, and the size of the repository of course).
svnsync sync file://$COPY