How to use the svn propset svn:externals property

I have been having a fun time today trying to figure out how to use the svn:externals property to include the contents of another project in my repository. The svn documentation is not really good at explaining this feature to the user. It is almost like they don’t even want you to know about it.

We are currently using this feature in our project to include a standard set of ivy properties and repository libraries wherever we need them in other projects. This is great, because now we can just point a project in svn to this standard project. When the user set’s the svn:externals property in there project, the libraries will be fetched with the next update.

Let’s say you have a svn project at https://svn.repo.com/build-libs/trunk. This repository contains some common libraries that are needed in all of the projects in your organization. You have recently created a new project and added it into svn. This svn project is https://svn.repo.com/new-project/trunk. The project layout is as follows:

-trunk
--src
--java

To add the libraries that have been checked into the build-lib project all you need to do is the following. Create a file called svn_ext.txt in the root level of your checked out project. In this file add the following line.
build-lib https://svn.repo.com/build-libs/trunk

Now execute the command in the current directory where you created the svn_ext.txt file.
svn propset svn:externals . -F svn_ext.txt

Now the next time you do a svn update of the new-project project the contents of the build-lib project will be pulled into your project.

I hope that this helps you out. I spent quite a while trying to figure this very simple thing out. Once you get it down it is a very powerful property that you will probably use a lot.

Posted on Apr 14, 2009 by Mike Jennings in Open Source | 0 Comments | Permalink