Wednesday, May 6, 2009

Connecting to external libraries using svn:externals

Subversion is a version control tool used by many software developers to manage changes within their source code as a version tree.

More often we tend to use external libraries in our project. While the external library is already versioned somewhere, storing them locally in our project's library is a mere waste of memory and we have to manually update our local copy everytime the external library gets updated.

To overcome this, SVN came up with a property called svn:externals. Let's consider a Zend Framework project where we need Zend library. I am going to connect to the lastest version of ZF, which is 1.8.0. 

In our application, the Zend library resides in "library/Zend" folder. The svn externals property is set on the parent folder (library) and will contain the value Directory RepositoryURL.

To set a property using TortoiseSVN, right click on the "library" folder, and select "TortiseSVN->Properties". From the properties dialog, click "Add" and select "svn:externals" from the Property value drop-down. In the value field, add  Zend http://framework.zend.com/svn/framework/standard/tags/release/1.8.0/library/Zend

Save and close the dialogue box. Now, do svn update on the "library" folder. This will create a folder called "Zend" inside "library" and will checkout the external repo.

You can connect to many external repositories from the same directory by adding each of them in newline.

Ciao :)

2 comments:

Laks said...

Great way to start! keep blogging

Anonymous said...

really a nice post