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:
- Create a local repository
svnadmin create c:/repos
It will create an empty repository on your local system. - 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. - Synchronize your local repository with the remote repository
svnsync init file:///c:/repos https://test.cvsdude.com/fbl svnsync sync file:///c:/repos
- Dump your local repository
svnadmin dump file:///c:/repos > repos.dmp
That would be all, you can now have a cup of coffee. :)