Let’s face it – if you are looking at this right now the chances are you already know what Subversion is, so I will skip the tedious ‘yadda, yadda, free, yadda, yadda, great, yadda, yadda’.

So let’s take a look at setting one up – there are a lot of these, some good and some bad. Most go into details of setting up Apache and allowing you access from a small orbital platform stationed above Mars, but the chances you need remote access like that is minimal. If you do then I suggest you go read those – by the way they are only written by guys with beards.

The first thing we’ll do is download the latest Subversion Windows binary installer which is currently 1.5. In the future it will be different, but the concepts will probably remain the same.

Double click the installer and allow it to install naturally. Once that is complete we could run svnserve and be done, but it can be so much more beautiful. Let’s run it as a service.

Now Subversion has one slight annoyance. It has a global revision number. So if you have a single repository with multiple projects all projects will use the same incrementing revision system. That’s not particularly nice – especially when a single line change of code will result in a several hundred (or thousand) revision leap because of activity on another project.

So I prefer multiple repositories. It’s pretty easy to do. Let’s say you name your projects after famous marques. So let’s create a couple of projects:

svnadmin create "d:\svn\ferrari"
svnadmin create "d:\svn\bugatti"

I use D as my development drive and have short monikers for all my folders – \dev, \svn, \db, etc.

Notice svnadmin created a few directories under both ferrari and bugatti. You need to go into each of these and edit the conf/svnserve.conf and the passwd files.

Uncomment the following lines in the conf/svnserve.conf file by removing the pound character from the start of each line:

anon-access = none
auth-access = write
password-db = passwd

Since the chances of working with a harry and sally are next to nil, delete their lines from passwd and replace it with your own:

graham.reeds = password

You will need to do this for each as outside the aforementioned Apache there is no real way of doing that.

Now that is complete let’s perform the final step of installing Subversion as a Windows service so that it is always available. Under OS’s other than XP you will need to find sc.exe otherwise Just issue the following command:

sc create svnserver binpath= "c:\program files\subversion\bin\svnserve.exe --service -r d:\svn" displayname= "Subversion" depend= Tcpip start= auto
sc description svnserver "Subversion server service (svnserver)"

It’s set to auto-start so it will start up automatically when your machine restarts but currently it’s not running. We can fix that while still at the command line by typing:

net start svnserver

Now the final thing to do is set it up so that when we do a commit we have an editor to write the comments in. Since svn doesn’t provide one then we will need to provide our own. So lets edit your environment settings and add SVN_EDITOR with the value of %systemroot%\system32\notepad.exe.

You could use Notepad++ but simple notepad is way easier and Notepad++ is too heavyweight for this job. In this one case the traditional notepad is the better option.

Next time I will show you how to populate those repositories.