Subversion Source Control

This post has been bouncing around my head for sometime since finding the time to write has been a little hard.

The fact is that the whole Subversion vs Git vs TFS vs [insert preferred system here] debate can get to the point where its quasi-religious (as are numerous other tech debates – windows vs mac being one of the notable ones).

Now I, bad developer that I am, have only recently started using Subversion. The need to sync source code between my desktop and my laptop outgrew the copy/paste via Windows Home Server share approach.

The fact that Subversion is free is also a big deal maker ( compared to, say Team Foundation Server).

I have been using it on another free product, namely Netbeans 6.01 for my Java development. Its nothing major, only university projects. 

The fact is that Netbeans comes with Subversion and CVN support baked into the IDE. Additionally, Netbeans uses its own Local History feature to keep track of your files wether you’re using formal source control or not. Every time you build your project it makes a commit to your Local History. This means that one has both Local history for the small changes and Subversion for the big changes.

The fact is that having it baked into the IDE makes all the difference – it allows one to interact with the code in revisions directly. Let me explain. One can make line-by-line rollbacks from your previous versions wether you are using Local history or Subversion or both. Powerfully, the rollbacks count as changes to your code and are committed right back to the database.

(I plan to do a post on the value of a good IDE soon as well)

image

In the (Subversion) case above, the local copy is out of date (on the right) and the remote changes (on the left) are shown in blue. The changes were made on my laptop, committed and I’m comparing them against the desktop copy of the files.

By clicking on the blue arrow one can insert the changes into the local copy with out inserting all the changes. The same applies for replacements (in cases where the lines have been modified rather than outright replaced).

The green area in the local copy no longer exists and by clicking on the red cross one can delete the highlighted lines.

Local History works in exactly the same way.

This is a small example and one needs to actually use it to understand the power of the concept.

Now, the fact is that the vast majority of my coding gets done in Visual Studio. And Visual Studio , the TFS edition aside, does not support source control. Period.

However, VisualSVN actually has an Add-In for Visual Studio that brings this functionality into the IDE. The problem is  that the Add-In isn’t free. Its $49 per licence. Personal licenses are restricted to one per order ( but not corporate licenses) and open source projects qualify for free licenses. And, no, I haven’t yet decided whether to get a license.

I agree with Jeff Atwood that software such as Firefox should take the most popular Add-Ins and fold them in the main code base. Which gives rise to the question that if Source Control is so important and popular (is it for non-TFS Visual Studio users????), why doesn’t Microsoft add it in?

I mean its only Subversion. Surely Microsoft must have some pretty good selling points related to why TFS is, like, totally better than Subversion ( 😉 ). That takes care of the “They already have source control” pundits.

Source Control is simply good programming practice and if Microsoft is serious about attracting people to its platform (and the freely available express editions shows that they are somewhat serious), they should provide it.

Contrast Visual Studio to Netbeans and that’s enough said on the subject.

Now the easiest way to install Subversion is to head over to Jeff’s blog post about it. If you don’t subscribe to Jeff’s blog, i suggest that you do – its invaluable.

I went the VisualSVN server route which set everything up with the addition of  the ability to browse the server using a web browser (it does this by using Apache). To avoid Apache conflicting with Windows Home Server, its running on a Virtual Server virtual machine ( that image runs a few other odds and ends). Setting up Virtual Server on WHS is itself the subject of another blog post. It took me literally 2 minutes.

Before letting you go, Scott Hanselman has a great podcast on Subversion vs Git for Source Control and it comes highly recommended.