Recovering a Subversion Repository After a Major Deletion

At the company I work for, we store all our client files in a subversion repository. As I walked through the door on Monday, I was greeted with the glorious news that all the client files were gone. Gone? Yep. Nothing. Nada. Blank repository. After a brief temptation to throw myself out our 25th floor window, I regained my composure and reminded myself that this was subversion: nothing is ever really gone.

svn log https://our.subversion.repo

Ah ha. At revision 5686 a “File/Folder was deleted”. Not very descriptive (thanks Subversion), but it’s the only reference to a deletion around the time the gates of hell opened and the spawn of Satan unleashed upon the earth.

So, I checkout a local copy of the current, destitute, repository. And try:

svn merge -rHEAD:5685 https://our.subversion.repo clients

And… drumroll… failure. Of course it couldn’t be that simple. Next:

svn up -r5685

Yay! Here comes all the client files… all… forty… six… gigs.

[flash forward one day]

So, I now have a local copy of the repo as it should be, but the actual repo is still empty. Now what? First, got to get rid of all those god-forsaken hidden .svn folders. I could simply run an export, but I really don’t want another 46 GB block on my computer. So I’ll use some find magic instead:

cd clients
find . -name ".svn*" -exec rm -rf "{}" \;

That took awhile. Now, all I have to do is checkout another working copy, move over all the files into the working copy, svn add and commit. No sweat.

Except…

Doh! Halfway into the process, the drive hosting the subversion repo reaches capacity and the commit fails miserably. At this point, I’m saying things I wouldn’t want my mother to hear. If you’re reading this, mom, that’s just a joke. I never curse.

Ideally, at this point, we’d go out, get a larger drive and move the repo over. Right. Have any of you actually worked in an office before? I’m told to delete the repo and re-import.

And, 6 hours later, our repo is back as it should be, only, at revision 1. If you haven’t guessed from the relatively low revision number mentioned previously, this isn’t the first time we had to start back at revision 1. Thankfully, there’s already documentation prepared (by me) for my coworkers to refresh any working copies they have on their computer.

I love my job.

  • Del.icio.us
  • Digg
  • Facebook
  • Google Bookmark
  • StumbleUpon
  • Technorati
  • Mike
    That *really* sucks, but seriously, who deleted the repo!??!
  • Haha... it's funny that everyone's first response is "Who did it?". All names have been changed to protect the innocent, etc. It was a silly mistake, a mistake that made my life hell for a couple of days, but a mistake nonetheless.
blog comments powered by Disqus