Don't Forgot svn:externals When Tagging in Subversion

The Problem

If any of you have ever dealt with external libraries or even your own shared libraries which are used in multiple projects, you've most likely worked with the svn:externals property. Yes, there are a few alternatives such as Piston, among others. All in all, svn:externals is pretty simple, but it does have one simple, but nasty gotcha when working with tags.

The idea behind a tag is to have a snapshot in time of your software such that it can be reconstructed at a known state. The externals attribute throws a wrench in the gears because, by default, Subversion pulls the HEAD revision from the external source. In other words, everything in your tag will be at a known state except the libraries pulled from the external source, which will be at their HEAD or most recent revision.

The Workaround

One way to solve the problem is to modify the subversion property to point to a particular revision, e.g.:

Old:

MyDependency http://3rdpartysource.com/tags/1.2.3/

New:

MyDependency -r1234 http://3rdpartysource.com/tags/1.2.3/

It's not difficult to modify the Subversion attributes, but it can be hard to remember. This is one more reason to fully automate your build process using a continuous integration server such as CruiseControl.NET or TeamCity - but that's a topic for another day.