Remote Backup Of A Subversion (svn) Repository

Yesterday I spent a lot of time trying to figure out how to take a complete backup of a subversion repository containing some code that I am currently working on. The generic way to do this is

svnadmin dump path-to-repos

but svnadmin only works on local repositories. However, medical I do not have shell access to the machine containing the repository and can only access it through its webDAV interface. I thought that since all revision information is available through the normal svn client, ampoule someone would have solved this problem nicely already. I googled around and could not find any obvious solutions. I found a the source to a program, link svn-push in the subversion repository contrib section. It is a bit unclear what this program actually does and I was unable to actually make it compile. After some more searching I stumbled acroos svk which is a program build on top of subversion. Eventually I found out that I could abuse this program to create a dump of my remote repository. First make sure that you have no previous svk history:

rm -rf ~/.svk

Then get information of the repository by issuing the following command and follow the instructions on screen

svk ls [subversion-repository-URL]

svk should then have built a local repository, the first two revisions to this are local svk information, we simply dump the rest:

svnadmin dump -r2:HEAD ~/.svk/local > my-repository-dump

If you have stored the repository with the same name as you original repository as part of the “ls” command, my-repository-dump should now contain the full revision and log information of the original remote repository. yay.

6 thoughts on “Remote Backup Of A Subversion (svn) Repository

  1. I stumbled across another approach while trying to implement yours.

    ~$ svnsync help initialize
    initialize (init): usage: svnsync initialize DEST_URL SOURCE_URL

    Initialize a destination repository for synchronization from
    another repository.

    The destination URL must point to the root of a repository with
    no committed revisions. The destination repository must allow
    revision property changes.

    If the source URL is not the root of a repository, only the
    specified part of the repository will be synchronized.

    You should not commit to, or make revision property changes in,
    the destination repository by any method other than ‘svnsync’.
    In other words, the destination repository should be a read-only
    mirror of the source repository.

    Valid options:
    –non-interactive : do no interactive prompting
    –no-auth-cache : do not cache authentication tokens
    –username ARG : specify a username ARG (deprecated;
    see –source-username and –sync-username)
    –password ARG : specify a password ARG (deprecated;
    see –source-password and –sync-password)
    –trust-server-cert : accept unknown SSL server certificates without
    prompting (but only with ‘–non-interactive’)
    –source-username ARG : connect to source repository with username ARG
    –source-password ARG : connect to source repository with password ARG
    –sync-username ARG : connect to sync repository with username ARG
    –sync-password ARG : connect to sync repository with password ARG
    –config-dir ARG : read user configuration files from directory ARG
    -q [–quiet] : print as little as possible

    ~$ rpm -q –whatprovides $(which svnsync)

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.