Mirroring a subversion repository

Some tools like Trac require a local copy of your Subversion repository (this requirement might be fixed in a newer version of Trac I guess, but for now it’s an example). If your server is running Subversion version 1.4 or higher then you can happily use svnsync to create a read-only mirror of the repo, but what if it isn’t?

Well, then the trick is to use svk to create the read-only mirror. There’s just one catch (there always is right?) When you init the local svk repo it writes a commit, so when you pull remote changeset #1 it commits it locally as changeset #2 (ugh, that breaks all the Trac links now). With a bit of cunning, you can pass `-s 2` to ask svk to skip the initial commit in your source repository, and start at commit #2.

So the first two commits are rolled up, and committed as changeset #2, and then all following commits are imported with matching changeset numbers!

Things to note: You MUST mirror the root of the repository, otherwise changesets will again go out of sync. (svnsync has the same restriction, so it’s not like svk is worse off here or anything)

One comment on “Mirroring a subversion repository

  1. As a side-note, we recently upgrade the master server to the latest version of svn, which means that we can now use svnsync. Not only that, but commits and history fetches seem much faster. (I’m not sure if it’s due to the new server code, or because we dumped out the old bdb repo and created a new fsfs repo – probably both)

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>