Trimming The Trunk In Subversion

I have a number of third party libraries that I use in my applications. I also have a number of utility type assemblies that I have created and re-use in many applications. In this post, I will show you how I use the subversion ‘externals’ feature to keep my application trunks lean and clean.

The Problem

Including re-usable assemblies in your application’s repository can lead to bloating. I typically pack away not only the compiled DLLs, but also the zipped up version of the code. In addition, I may have applications that depend on different versions of the library. This quickly makes my third party library very sizeable and too heavy to include in every project. Here is a screen shot of part of my third party library as it exists on my hard drive.

image

Notice that each library has a version folder (or many version folders) as the first child. Inside the version folder is a folder of binaries (DLLs) and a zipped up file containing code for this version. All of these files / folders are checked into source control into a third party repository.

I don’t want to include these files in every application’s repository. What I would like to include is just the content of the binaries folders and only for the third party libraries that I am using in the project.

The Solution

Here is a screen shot of the folders / files for a website that I am building. Notice, there is an ‘Externals’ folder. This is where I want all the external library DLLs to appear.

image

As you can see, in the above example, I am using three third party libraries: cutting edge conditions, mysql connector, and an XML provider. I could add the DLLs to these folders and manually manage the ‘Externals’ folder. However, subversion has a nice feature that allows you to connect multiple repositories. In the example below I am using TortoiseSVN.

To setup this feature right-click the ‘Externals’ folder and select the TortoiseSVN – Properties menu item.

image

Click the “New…” button. For the “Property name:” element select the “svn:externals” option.

image

In my case I entered the following property values:

https://svn.trunksapp.com/rcravens/3rd_party_libs/CuttingEdge.Conditions/version_1_0/Binaries CuttingEdge
https://svn.trunksapp.com/rcravens/3rd_party_libs/MySql/version_6_2_2/Binaries MySql
https://svn.trunksapp.com/rcravens/3rd_party_libs/XmlProviderLibrary/version_1_0_0_5/Binaries XmlProvider

These properties have the following format: <a folder in subersion> <local folder name>

Once you define these, the application’s repository will not contain the bytes associated with these libraries.

image In essence you have configured a pointer to the files. However, when you load a local copy of your repository, the files are pulled in from the external repos.

Summary

Using this configuration, you can save a bit of space in your subversion repository. In addition it makes moving to the next version as simple as adjusting the link in the externals configuration.

Comments
  1. Ted Krumbach

Leave a Reply

Your email address will not be published.

*