All in the <head>

– Ponderings & code by Drew McLellan –

– Live from The Internets since 2003 –

About

Subversion

27 April 2004

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?

- Drew McLellan

Comments

  1. § Arnaud: Except the obvious choice of command line I’ve heard good things about TortoiseSVN for windows. It integrates in the explorer and makes it easy to work on files.
  2. § Mike Jones: I just had a look at the Debian packages site for it and looked at the pre-reqs and they seem to say it requires an element of apache2 (libapr0) but not apache2 itself configured… I haven’t tried it yet but it looks good. Anyone know if it integrates with Eclipse?
  3. § Jesse: Just gone through some testing with it – more just seeing if it works. Next is figuring out how it can work with what we do.. but it looks really good. Given we are doing more work with people who are in other buildings, I hope it works.
  4. § jason: I started using it last Fall without any problems.

    The client on Mac OS X is commandline and compiles and builds quite nicely. TortoiseSVN on windows is the way to go.

    Setting up the server is a little trickier with some things to watch out for.

    Let me know if you want a repository to access and try out. I’ve been setting them up as part of a hosting service.

    The other great thing is the possibility of using WebDAV clients instead of svn clients. I’ve tried out autoversioning with apache 2.1 and it works with MacOS X’s Finder webdav client and Adobe’s Workgroup functions. Just need mod_dav_lock to be backported to Apache 2.0 or have 2.1 go stable.
  5. § Mark bdash Rowe: I have been using Subversion on open source projects for several months now, and it has been a breath of fresh air after using CVS. Atomic commits and conceptually simple branching and tagging are the biggest pluses from my point of view.

    The biggest thing to look out for is having a repository accessible by more than one protocol, eg. HTTP and SVN over SSH. This can lead to problems with the repository database being owned by the incorrect user or group. It’s easily fixed, and easy to prevent as long as you are aware of the potential problem.

    The best resource that I have found for Subversion is the online edition of O’Reilly’s Version Control With Subversion. It is a comprehensive guide to using Subversion, and contains almost everything that you would like to know about its use.

    If you’re interested in a issue tracking system that integrates with Subversion, be sure to have a look at Trac. It’s easy to install, nice to use, and the price is right.
  6. § hunter: Subversion is great. I started using it pre-1.0. For web design / development projects it works very well (even for a one man operation). Using gentoo it has been a no brainer to install, just emerge and create a repository.

    I’ve been waiting for an eclipse plugin and although there is one that has been written by the subversion developers, it hasn’t been updated for a while. tigris has more info. At least TortoiseSVN is a solid solution in the meantime.
  7. § Tim Parkin: We’ve been using subversion for everything we do from client documents through scratch projects to full software development and have to say it’s been 99.9% cool (I have vague problems with locks occasionally but I think thats our svn server being a little old).

    I’ve tried using rapidsvn and it’s a little flaky, I was going to try gsvn but it’s been abandoned.

    I then went back to tortoiseSVN, after having been a user of TortoiseCVS for years. TortoiseSVN is the bees knees, quickly setup to work over ssh (don’t forget to install and set up pageant for passwordless use) and it ‘just works’.

    Rearranging folders is now easy with svn mv and svn cp (move and copy). Just a final addition, my main machine is debian and I use a vmware windows xp pro session for all the windows stuff that comes in handy occasionally.

    As for IDE integration, it hasn’t really been an issue, if your ide uses windows explorer then you get the functionality on a right click. The only wierd thing is setting up ie4desktop stuff (read the manual on why you’re not getting icons). oops.. that was a long post :-) go for it!!
  8. § ozzy: There’s this really cool project management package called Track ( http://projects.edgewall.com/trac ) thats has Subversion repository, Wiki, ticketing system etc. Check it out!

Photographs

Work With Me

edgeofmyseat.com logo

At edgeofmyseat.com we build custom content management systems, ecommerce solutions and develop web apps.

Follow me

Recent Links

Affiliation

  • Web Standards Project
  • Britpack
  • 24 ways

I made

Perch - a really little cms

About Drew McLellan

Photo of Drew McLellan

Drew McLellan (@drewm) has been hacking on the web since around 1996 following an unfortunate incident with a margarine tub. Since then he’s spread himself between both front- and back-end development projects, and now is Director and Senior Web Developer at edgeofmyseat.com in Maidenhead, UK (GEO: 51.5217, -0.7177). Prior to this, Drew was a Web Developer for Yahoo!, and before that primarily worked as a technical lead within design and branding agencies for clients such as Nissan, Goodyear Dunlop, Siemens/Bosch, Cadburys, ICI Dulux and Virgin.net. Somewhere along the way, Drew managed to get himself embroiled with Dreamweaver and was made an early Macromedia Evangelist for that product. This lead to book deals, public appearances, fame, glory, and his eventual downfall.

Picking himself up again, Drew is now a strong advocate for best practises, and stood as Group Lead for The Web Standards Project 2006-08. He has had articles published by A List Apart, Adobe, and O’Reilly Media’s XML.com, mostly due to mistaken identity. Drew is a proponent of the lower-case semantic web, and is currently expending energies in the direction of the microformats movement, with particular interests in making parsers an off-the-shelf commodity and developing simple UI conventions. He writes here at all in the head and, with a little help from his friends, at 24 ways.