Mirror subversion repositories


There are different ways to generate mirrors of subversion repositories like svnadmin dump, svnadmin hotcopy or svk but you need more privileges to do it or will not create a "perfect" copy. Since subversion 1.4 exists a new alternative svnsync. It is really easy to create a private mirror with only some steps (you should check user in pre-revprop-change before make it public accessible).

svnadmin create "${REPO_TITLE}"
cat > "${REPO_TITLE}"/hooks/pre-revprop-change << 'EOF'
#! /bin/sh
exit 0
chmod +x "${REPO_TITLE}"/hooks/pre-revprop-change
svnsync init "file://`pwd`/${REPO_TITLE}" "${REPO_URL}"

A good idea is to check the UUID of the master repository by using svn info "${REPO_URL}" and change it with svnadmin setuuid "${REPO_TITLE}" 45894c77-fb22-0410-b583-ff6e7d5dbf6c.

You should do your syncs regularly (for example with cron) with

svnsync sync "file://`pwd`/${REPO_TITLE}"