The past two days have been a complete nightmare… I’m on an important deadline when I noticed some very strange posts appear on Afrigator. Posts from sites like Mashable and Boing-Boing. Wow! They like Afrigator that much that they’ve subscribed?! Although I’d love to believe that is the case, it simply was not true… I digress.
I started delving into our parser scripts trying to root out the problem on ground level. Make changes left, right and center. Testing, redo-ing, answering the phone, answering calls on Skype from my sweet love of my life, losing track of what I’ve done and BAM! things are a complete mess…
So, what would be the quickest solution? Start over and do it properly. At least, for me that is sometimes the best option. Now, if you’re having nightmare days, you’ll know when it happens that you bugger shit up so badly that you’ve completely forgot to make backups before you started breaking your months of hard work. Its that sickening sinking feeling…
Fortunately, Subversion (SVN) is not only for keeping revisions of your software, but actually allows you to go back to a snapshot of your code right about where you started doing the dumb stuff. There are a number of ways to recover, although this was what I did as a quick and dirty solution. Took me less than a minute.
Find what the revision number is before you mucked it up.
Export that revision to a different directory.
svn export http://svn.afrigator.com/trunk/ -r 4815
Copy the source file back to your working repository.
Check it in
svn ci -m "Fix the mess I made"
Viola! You’re good to go and start messing it up from scratch again!
Now I do know that the best way to prevent this from happening is to never have it happen in the first place, but hell, if and when it happens, be thankful that you’ve got SVN!
Welcome back! You should subscribe to my RSS feed here.
You should follow me on Twitter here
You should follow me on Gatorpeeps here.







StevenMcD 4:08 pm on December 3, 2008 Permalink |
We tried implementing SVN with Visual Studio 2008 but it was a complete FAIL. The merging of files gave us issues.
SourceSafe with VS2008 still rocks, but SVN definitely has its place. Glad it could sort you out though
Stii 4:17 pm on December 3, 2008 Permalink |
I’ve worked with SourceSafe before and it is brilliant. Specially the way it fits into VS. There are quite a lot of subversioning software apps out there, all with their own strengths and weaknesses. Point is, you should at least have something like that, else you’re stuffed in the above mentioned situation!
Neil Blakey-Milner 4:23 pm on December 3, 2008 Permalink |
You really should use merge rather than export, copy, and check-in. Merge will get rid of files that you’ve created since you screwed up, for example.
In your checkout, assuming you’ve got a clean latest checkout, you can run:
$ svn merge -r BASE:4815 .
$ svn commit -m “Revert back to r4815″
That will revert you back to exactly 4815, with no chance of errors coming in.
Neil
Stii 4:37 pm on December 3, 2008 Permalink |
Thanx Neil,
You’re right, but I didn’t want to do that because there was a bunch of files that I didn’t want to get rid of. I was taking a quick and dirty shortcut. Although I’m sure its probably not even good practice, it worked like a bomb for me.