This is a quickie and yeh, I don’t like Subversion either, and if you’re still using that consider Git or Mercurial. Anyways, I had an old Subversion server where four SVN repositories were hosted for quite some time and a few days ago I decided to nuke that in order to reduce our costs. Thank god I created a simple
tar -czf of the whole directory and I know it’s not the correct way to backup Subversion repos, but I literally had no time to think and play around. Besides, I didn’t think I would ever need those again…
I was wrong, two days later I got a request for a few files that were only in that SVN repo, they never made it to our Git servers since we thought we’d never need them again. I thought this was going to be a nightmare, especially after reading some tutorials explaining how and why Subversion repos have to be backed up and restored. For a second or two I thought we lost those files forever!
Luckily, it wasn’t that bad. I had the archive copies on my local Ubuntu machine, I extracted them and tried my luck at
svnadmin verify repo_dir and bing! Verified all 1700 revisions! Maybe this was a coincidence, same version of Subversion, similar operating system, … Here’s how I checked out my latest revision and got those files safe and sound:
$ svn checkout file:///home/user/backup/svn/repo_dir .
And that worked perfectly! Took a while, but it did, so this post may come in handy, but the lessons to be learned here are: don’t use Subversion (go with Git or Mercurial), if you do use Subversion then use the correct ways and tools to backup and restore repositories (Google that for some great articles), and local repositories can be checked out with the
file:/// prefix. Yeh, three slashes, and on Windows environments too ;)
Hope that helped you out. Cheers!