Dumping a remote SVN repository without admin access

When you need to dump a SVN repository, all you have to do is

svnadmin dump REPOS_PATH

But wait, then you need to have admin access to the server on which your SVN repository is hosted. Often, that is not the case and you have to contact the company which hosts your repository to do it for you. I have a repository hosted at CVSdude and I needed to dump it. As I am on the Developer Edition plan, I do not enjoy the privileges to backup my repositories from my admin panel. I could have mailed the guys at cvsdude, who according to me are quite supportive and quick to respond, but that would have taken longer than what I am going to describe next.

SVN provides a unique utility, svnsync which is a Subversion remote repository mirroring tool. Put simply, it allows you to replay the revisions of one repository into another one. Now, we can create an empty repository on our local system, synchronize it with the remote repository and then dump the local repository. Follow the following 4 step process to have a dump of your repository:

  1. Create a local repository
    svnadmin create c:/repos

    It will create an empty repository on your local system.

  2. Add โ€œpre-revprop-changeโ€ hook to your local repository
    You need to add an empty file into the hooks folder of your repository. This file should be named pre-revprop-change.cmd on Windows and pre-revprop-change on Linux systems.
    For Linux users:

    echo โ€˜#!/bin/shโ€™ > repos/hooks/pre-revprop-change
    chmod +x repos/hooks/pre-revprop-change

    This allows svnsync to make revision changes to your local repository. Note that your remote repository is never modified during this process, in fact we just need read access to the remote repository.

  3. Synchronize your local repository with the remote repository
    svnsync init file:///c:/repos https://test.cvsdude.com/fbl
    svnsync sync file:///c:/repos
  4. Dump your local repository
    svnadmin dump file:///c:/repos > repos.dmp

That would be all, you can now have a cup of coffee. ๐Ÿ™‚

4 thoughts on “Dumping a remote SVN repository without admin access

  1. Philip

    Hi Nitin,

    You’ve mentioned what you should put into the pre-revprop-change hook for linux, but what do you write inside the pre-revprop-change.cmd for Windows? Thanks ๐Ÿ™‚

    Reply

Leave a Reply