All in the <head> – Ponderings and code by Drew McLellan –


When developing in a team environment, it’s essential to have some sort of source control in place to facilitate the process of multiple people working on the same set of files. At a very basic level, you need something to prevent developers over-writing each others edits. This occurs when two people are working independently on the same file – Developer A saves their edits, and the Developer B saves theirs, overwriting the work just done by A. Tools like Dreamweaver handle this situation by file locking. When someone checks a file out for edits, the original file is locked so that no one else can edit it.

File locking works fine for simple projects – such as flat web sites. As soon as you have any degree of reusable application logic involved the whole situation becomes a lot more complex. The scenario can occur whereby two developers make incompatible changes to different parts of the application – the result is that the whole app is blown out of the water and nothing functions at all. Without source control, the solution to this problem is either to restore from backup and lose the day’s work, or for the developers to get their heads together and pick through the code until they find the problem and engineer a solution – all the while the app is offline and other developers are left twiddling their thumbs. With proper source control that keeps track of versions, the incompatible edits can simply be rolled back to the working version (bringing the app back online in no time at all) and then the troublesome twosome can get their heads together and work out what went wrong in a far less expensive way.

So this is basic stuff, and most web developers will be familiar with source control systems like Microsoft SourceSafe, and the open source CVS. CVS is very widely used in the open source community as it’s very capable and works really well across the wire. It does have its limitations, however, and is also getting a little long in the tooth. Enter Subversion.

Subversion is designed to replace CVS by providing the same features as CVS and fixing a lot of its shortcomings at the same time. It utilizes WebDAV and Apache 2 (although you can run this concurrently with your production Apache 1.3 server, on a different port), and offers new features such as directory – not just file – versioning, and better handling of binary files, which is useful for web projects with lots of graphics.

I’ve already got CVS running here at work, but as I’m about to kick off a big new project and as Subversion hit the magic version 1.0.0 in February, I thought it might be worth a try. There seem to be a range of clients for Linux, Windows and Mac OS X, so that covers all my bases. Any one else using it yet, and with good or bad results?