If you’ve used Microsoft development products before, you’ve most likely come across Source Safe. It’s “ok” I guess but does suffer from some problems, and I’ve been too close to more than one corrupted database for comfort.
A more robust version control solution is the open source Subversion. Widely used in the Java community it’s also available for use over the Microsoft side of the fence. As well as being very robust, a couple of other features are it’s optimistic Copy-Modify-Merge model and excellent support for distributed teams. All these together make it suitable for use on large projects.
Version control isn’t just for code either. I’ve even heard a few celebrity geeks on TWIT say they use it for a document repository.
Grab the SVN installer for the server & client. You’ll want SVN 1.5 as the latest version isn’t supported by AnkhSVN yet.
Choose the path to your repository. Ideally this should be on another machine, but below I’m choosing a folder under My Documents, so it at least gets backed up with the rest of my stuff.
I’d recommend creating a root folder for SVN then a folder for your first repository under that. As you may want more than one repository in the future. Doing this also makes the setup work without having to tweak the Apache configuration.
The next setup screen alters some stuff in the Apache configuration for you. You’ll probably want to change the port away from the default of 80. Now, the repository path isn’t the path you put in above, but the root SVN folder. The location prefix tells Apache to pass any URLs starting in “svn” through to the SVN server.
After the installer' has finished, start the relevant services. (“Apache2.2” and “Subversion Server”).
Then crack open a command prompt and create your repository with
svnadmin create <path to repository>
In this example, the path I gave it was “D:\Users\Brian\Documents\svn\repos”
Badaboom – SVN is all up & running. You can test it by opening a browser and going to http://localhost:81. You should get a page that says “It Works!” – that’s just Apache. To test the SVN server is working & Apache is forwarding requests to it, browse to http://localhost:81/svn/repos/ You’ll get “repos - Revision 0: /”
This bit’s optional, but you’re better off knowing the relevant bits in the Apache config, just in case you want to change it.
The config is in <Install folder for the subversion software>\httpd\conf\httpd.conf & these are the important bits:
LoadModule dav_module modules/mod_dav.so
This tells Apache to load the WebDAV module, so you can access your repository through a web browser.
LoadModule dav_svn_module modules/mod_dav_svn.so
This tells Apache to load the Subversion module.
The port Apache is listening for HTTP requests on.
DocumentRoot "E:\Program Files\CollabNet Subversion Server/httpd/htdocs"
The root folder for the web site served by this Apache instance. You can serve up HTML pages form here if you like. One thing Apache is really good for though is serving up XML schemas & doing nifty things like URL rewriting.
This tells Apache that if it gets any URLS starting in \svn just to pass them onto the SVN module loaded earlier. SVNParentPath is a bit of configuration for the module. It’s the folder above your repositories. This is handy If you want more than one repository. If you’re sure you only want one, then you can change the directive to SVNPath and the argument to point directly to the repository folder itself, instead of the parent.
The installer for Ankh is just a click through. So no sweat. You’ll want version 2.0 if you’re using VS 2008.
Adding a Solution
As for where to, you’ll have a couple of choices. If the repository is on your local machine, you can just use the file protocol and give the path to the repository:
or the Subversion protocol:
Alternatively, if it’s on another machine, you can go through the SVN service with the URL:
or over HTTP:
I’d recommend checking the Add a Trunk folder box. To understand why, have a read of the “Version Control with Subversion” pdf book that was installed with SVN. There is a link on your start menu.
Adding the project doesn't commit the changes straight away, you’ll see the list of changes in the Pending Changes window. It’s fairly obvious how to drive it from here. Check the AnkhSVN site for more details.
Optional – Tortoise SVN
While you’re at it, grab Tortoise SVN, a GUI client for Subversion. You can do everything with the command line tools, but really, why would you? It’ll create and browse repositories, call SVN diff & much more all from a right click in Windows Explorer.