Thursday, May 17, 2007

I have a man-crush on Subversion.

I've got a big problem and I'm not afraid to admit it, so here it is - I've become obsessed with Subversion. For honest, really.
I'm a .Net developer, so this is sort of a problem - why not use Visual SourceSafe like everyone else? I mean, it's good, right?
I guess in the sense that it sort of works, yeah. But on Windows, the combination of Subversion and TortoiseSVN is so very very nice that once you go with Subversion (SVN), you won't look back. Actually, strike that. I guess you might look back fondly on VSS like you do other apps that took their design pointers from their fellow Windows 3.11 programs and that cause something just short of physical pain used over a WAN connection if you'd like.
If you're a Windows person, installing Subversion can be a bit of a mystery. You'll ask The Google about it and it will tell you odd things like you need some SVN service (that has been deprecated) and eventually you'll find a text file that explains how to install SVN as a Windows service with the newer revisions... sort of. But if you're like me, you don't want to read a poorly-written, incomplete text file that doesn't apply to you, you want results and you want them now.
So here's how you install Subversion 1.4.3 (the current version) on Windows.
  1. Hit up Subversion's site and download the Windows version of the application (you want the 1.4.3 setup executable)
  2. Go to TortoiseSVN's internets site and ask it nicely for a copy of TortoiseSVN
    1. If you're running Windows 2000 and not XP/Server 2003, now would be a good time to download a copy of SC.exe
  3. Install Subversion (into c:\subversion rather than underneath Program Files), then install TortoiseSVN (reboot if it asks you to because we are, after all, running Windows)
  4. When you're ready, drop to a command prompt (win+r->CMD) and issue the following commands
    1. cd\
    2. svnadmin create svnrepos
    3. sc create Subversion binpath= "c:\subversion\bin\svnserve.exe --service --root c:\svnrepos" start= auto depend= tcpip
  5. ???
  6. Profit!
So what did you do there? Well, you created a new SVN repository (the place where the files go) named svnrepos directly under the root. And then you used SC, service controller, to install an auto-starting instance of the SVN server as a Windows service.
What now? Fire up TortoiseSVN's repository browser (open Explorer, right-click on something and it'll be under TortoiseSVN's new context menu) and connect to "svn://localhost". You should see an empty repository and that means that the magic is there waiting for you. You can create directories here or you can import a directory (put it under revision control) and create and add directories.
Still not sold? Here's some of the reasons that I made the jump.
  1. Group-based, directory-level access control
    1. Imagine - QA can look, but can't touch (and you can't touch their scripts either)
  2. Pre- and post-commit hooks
    1. No more check-ins without comments attached; the server swats anyone who tries it (yes, that's a pet peeve of mine)
  3. RSS feeds
    1. VSS has a service that someone else wrote that sucked a little less when I made it multithreaded, but it still sucked (no offense as I was impressed by the mere fact that it existed). SVN's is sane and performant.
  4. Statistics
    1. Lines of code! Code churn! Developer stats! Way more fun than it should be for the procrastinator in all of us.
Don't you want to feel like you've accomplished something today? Get your Subversion on, kids.

No comments: