Mirroring the varnish-cache repository with svnsync

Quoting the Wikipedia about Varnish cache:

Varnish is a high performance HTTP accelerator designed for content-heavy dynamic web sites.

The main development repository of Varnish is very easy to browse, using Trac. You can see the latest changes through the web interface at:


If you want to browse the history of Varnish when you are offline, a web interface doesn’t really cut it. You will have to somehow “mirror” the official repository.

Fortunately, Subversion supports read-only mirroring of repositories, using the svnsync utility. The documentation of svnsync is not really very good, but after a bit of Googling, it is easy to locate the svnsync mini-guide of Paul Querna at:


Adopting this mini-guide to the Varnish repository, here’s a short guide which lists all the steps you will have to perform to create a read-only mirror of the Subversion repository of Varnish.

1. Initialize a new, empty Subversion repository

$ mkdir -p /ws/varnish/svnroot
$ svnadmin create /ws/varnish/svnroot

2. Create an empty ‘pre-revprop-change’ hook

The svnsync utility requires a valid “pre-revprop-change” hook script in the target Subversion repository. It does not really matter if the hook does absolutely nothing. The only requirement is that it exists, and that it is executable:

$ echo '#!/bin/sh' > /ws/varnish/svnroot/hooks/pre-revprop-change
$ chmod 0755 /ws/varnish/svnroot/hooks/pre-revprop-change

3. Set up your environment for the conversion

It gets tedious having to type the same stuff multiple times, so it will be useful to have the source and target repositories available as handy shell variables:

$ export TOREPO='file:///ws/varnish/svnroot'
export FROMREPO='http://varnish.projects.linpro.no/svn'

4. Initialize the target repository of svnsync

$ svnsync init ${TOREPO} ${FROMREPO}
$ svn proplist --revprop -r 0 ${TOREPO}

After this step it should be possible to look at the “svn:sync-from-url” property of the target repository and see the stored URI of the source repository:

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

5. Start the synchronization of the target repository

svnsync --non-interactive sync ${TOREPO}

This should start pulling changesets over HTTP and committing them in the target repository.

The synchronization process may be interrupted and resumed later. It will keep pulling changes incrementally, from the point where it stopped.


The whole synchronization thing is not really optimal, as far as speed or time is concerned, because it pulls each Subversion changeset separately. This tends to be a bit slow, if you are behind a congested or slow connection. But it eventually completes. When it does, you can use the read-only local repository mirror quite easily:

$ svn log -r 1314 file:///ws/varnish/svnroot
r1314 | phk | 2007-04-19 12:34:45 +0300 (Thu, 19 Apr 2007) | 3 lines

Standards compliance: fputs(3) returns non-negative on success.


2 thoughts on “Mirroring the varnish-cache repository with svnsync

  1. pejman

    Hi,ineed some information about varnish(what is it?how it work?requirment for install and how install varnish)thanks

Comments are closed.