EmailLinkedInGoogle+TwitterFacebook

Subversion provides a natural way to pull together resources from different parts of one or more subversion repository locations into a single working folder.  Once setup the commits are pushed into correct parent locations and updates are pulled from the initially configured urls.  This mechanism works equivalent to the symbolic links.  Here is an example.

Step 1:

Create a folder ./externals

Step 2:

Add the new folder into repository using command,

svn add ./externals

Step 3:

Create a file “externals.txt” with these two lines

tomcat/bin http://svn.apache.org/repos/asf/tomcat/tc6.0.x/trunk/bin 
apacheds/resources http://svn.apache.org/repos/asf/directory/apacheds/tags/1.5.7/resources

Step 4:

From command line run the following command.

svn propset svn:externals ./externals -F externals.txt

You are all set.  Any updates on externals folder (after committing the newly created folder) will fetch you the latest from tomcat/trunk and apacheds/tags/1.5.7/resources.  What the command has done is to set a property names ‘svn:externals’ into the folder metadata of folder ‘externals’ that tells svn client that some of its child folders are to be fetched/updated/committed through a different repository location.

  If you change any parts of the “externals” code, you will be able to check it in right into the correct code-base.  This solution avoids potential mess ups involving code base mash-ups.

One flipside of this solution is that while branching or tagging you will need to be extra careful in case your symbolic links also needs to shift.  To this effect it is worth noting that there are other useful commands for managing svn folder properties.  Check out the documentation here.

There is subverison documentation discussing this feature.  But I did not find it very easy to understand.

One Thought on “Folder links in subversion (svn)

  1. Navin on April 25, 2011 at 2:26 pm said:

    Hey Boni,

    I am part of a startup, we are looking for a software architect. Can you contact me pls – navin@vidyartha.com

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Post Navigation