I’ve been using Subversion for quite some time, and yet I don’t consider myself an expert on it because for the most part it just does what I need without much effort on my part. Most of that is thanks to VisualSVN Server, which makes the whole process of running Subversion in a Windows environment so incredibly easy.
All of that is a bit of a long introduction to what’s going to be an incredibly short post about getting svnsync up and running with VisualSVN server. If you don’t know what svnsync is then you can probably guess from the name alone – it’s Subversion’s way of replicating a repository, something I’m doing to an offsite location as an additional layer of backup for my code.
There’s a range of good guides out there which cover configuring and using svnsync which should give you most of what you need to get up and running, but I’m going to add a couple of quick notes from my experiences below:
1. Configuring the pre-revprop-change-hook in VisualSVN in the destination repository – the guide I mentioned earlier gives a Unix specific example, and I found a lot of other people talking about this hook in the context of svnsync without anyone mentioning the simple fact that this hook needs to exist, but it can be blank. From VisualSVN Manager, right click on your repo and select “All Tasks \ Manage Hooks”. Select “Pre-revision property change hook” and edit that – enter a couple of blank lines then click ok. Done. The hook will now be listed in bold indicating it exists.
If you don’t have this configured, then you’ll get an error saying “svnsync: DAV request failed; it's possible that the repository's pre-revprop-change hook either failed or is non-existent” when you try and sync or init.
2. Credentials – you should only need to enter your repository credentials when you perform the init of the mirrored repository. For some reason, my first sync failed until I provided credentials, but subsequent sync operations appear to be working fine.
And that’s it!