synsync: another way to remotely backup / svnadmin dump an SVN repository

Last month, I described an approach using SVK to remotely clone and then “svnadmin dump” an SVN repository. It turns out that there is an easier way “in the box” in SVN 1.4: the svnsync tool. Bob Ippolito describes how to do it, here are the minimal steps:

$ MYREPO=/home/me/someplace    (do not use ~username, use /home/username)
$ svnadmin create $MYREPO
$ echo “#!/bin/sh” >$MYREPO/hooks/pre-revprop-change
$ chmod +x $MYREPO/hooks/pre-revprop-change
$ svnsync init file://$MYREPO http://SVN.remote.url.goes.here/
$ svnsync sync file://$MYREPO

… then repeat the “svnsync sync” to sync down the changes since last time, perhaps in a cron job.

Paul Querna describes some caveats, and Cheah Chu Yeow offers a longer walkthrough of a more “produciton-grade” svnsync setup.

Like the SVK approach, with synsync you get a local mirror of a remote repo, with no need for shell access to that repo – very helpful if the repo is hosted by, for example, a SVN hosting firm, SourceForge, or Google Code. This local mirror can be used to view project history without network access, to svnadmin dump for backups, to mirror efficiently in another source control tool (I’m doing this with git as a test now, for one of our projects), etc.

5 thoughts on “synsync: another way to remotely backup / svnadmin dump an SVN repository”

  1. I’m just getting the hang of Subversion. I’ve got a repository on a server, and do my work on my notebook. I like Subversion, but I want something that I can use off-line. In some ways, I’m just looking for something that will proxy svn actions and cache them until I get online. But I guess that’s not really a feasible idea, since the repository could change, and the proxy would not know how to handle it.

    So I’m looking for suggestions and comparisons between the distributed version control systems. I like the way SVK lets me leverage my existing Subversion repository and tools. How do other systems compare?

  2. As far as I can tell from looking around at various tools, for the situation you describe (you want some distributed features, with a central SVN repo), SVK is the obvious choice. It is designed for that use case (though perhaps not exclusively for that use case). You can probably accomplish something like this with most of the other distributed tools. I’ve experiment with that using both bzr and git.

    I’ve though of giving a talk on this subject (using a distributed source control tool, on a project which has a central repo in a legacy centralized source control system); but I haven’t figured out where to offer such a talk.

  3. I’ve been hoping to attend a talk on this subject. 😉 Jeff Barczewski had mentioned that he had also been looking at Bazaar and at least one of the others. Bazaar appears to be more well-maintained and well-documented than SVK, which is why I was considering it.

    I’ve been thinking for a while now that we should have an Advanced Programmers Group in town. I suppose the XP group (which I’ve never attended — their meetings seem to be very infrequent) and the Ruby group are the closest we have. This topic would be great for a group like that.

    In the meantime, I guess I’ll give SVK a try, and see if it works for me.

  4. Thanks for this entry,

    I am using this to migrate all my code to a new dedi 🙂 SOurceforge is just so slow for me.

    One thing I do need to mention as it appears this will only sync with the SVNRoot, which for me is a bit of a pain as wordpress for one just creates folders rather than new repo’s meaning to get the revision history of my project I am having now to mirror the entire wordpress SVN and then delete everything except what I want :'(

  5. This is an old post, but it has just helped me, so I figured out I should say thanks!

    Minor warning – the “double quotes” on the echo order got “pretty formatted” when I copy pasted them. I had to replace them by apostrophes.

Comments are closed.