Adding an External SVN Resource With Tortoise SVN

Most of my projects are usually checked out at several different computers and several different operating systems. For Windows, there is The One SVN Client Above All Else, namely TortoiseSVN. As Christer and I’ve been working on an unnamed project lately, we’ve built up a set of resources in regards to basic functionality (user registration, user verification, access management, etc). These resources have become a small framework for a basic site, so I’ve adopted the set of files for several other projects. When using the “Framework” in other codebases, I still want to keep the framework versioned against the original SVN repository, so that if Christer commits his Überkool Must Have Feature v2.5 to the framework, I get all the magic with a single svn up.

The magical way ofdoing this is using the svn:external property to tell svn that you depend on an external repository. The property is set on the parent directory, and contains the value Directory RepositoryURL; i.e:

Property Value
svn:externals Framework

To set a property using TortoiseSVN, right click on the parent directory (i.e. libs or whatever you prefer to call your directory of common code), and select “TortoiseSVN” and “Properties”. Click “Add” and select svn:externals from the pulldown menu. In the value field you simply add Framework Close the dialogs and select SVN Update when right clicking on your libs directory. This will create a directory named Framework in libs and check out the svn repository to the directory.

If you want several repositories as external dependencies in the same directory, add each repository on a new line.


UPDATE: Erik Hansen adds:
In order for Tortoise to “Update” your local copy with the external files, you first need to commit the property change to the REPO before it will do that.

UPDATE: Harry asked:

How do I provide other usernames and passwords for the other repositories? If my memory serves me right, as long as you’ve checked out the resource previously with TortoiseSVN, it will remember your username and password. I’d like an update for this, tho, as I’ve not been able to test it myself at the present time.

UPDATE: Chris added:
If you want several repositories checked out as external sources, add each repository on a new line under the same svn:externals property. Each directory can only have one externals entry, but the property may contain several repositories as long as they’re each put on a new line.