Attaching External SVN Repositories - svn:externals

Loading

The scenario:

  • You are using subversion as the version control software for your project
  • Your project depends on other projects, perhaps third party libraries
  • The other projects also use subversion as the version control software for their project

How do you keep track of the version changes in the external project? Check out the external project to a particular directory in your project and keep it up to date by periodically issuing the command 'svn up'. This method works. But wouldn't it be cool if svn handled it automatically for you?

svn:externals is the solution.

I work on many PHP projects that depend on the Zend Framework. I use subversion for these projects. Zend Framework also uses subversion. Zend Framework has a fairly faster release cycle. Every time the Zend Framework makes a release, I want my project to use the latest Zend Framework release. Here's how I do it.

I have stored the Zend Framework files in my library/Zend directory.

Make sure you have set the SVN_EDITOR environment variable to your favourite editor.

Step 1: Navigate to the library directory.

cd path/to/library

Step 2: Make sure your working copy is up to date.

svn up

Step 3: Edit the svn:externals property of the current directory.

svn propedit svn:externals .

The editor window opens. In the editor window type the directory name and the external project SVN URL separated by a space. Save the file and exit.

Step 4: In my example, I want to store the Zend Framework files in the directory library/Zend. The SVN check URL of the Zend Framework ie http://framework.zend.com/svn/framework/standard/tags/release-1.9.3PL1/library/Zend

Zend http://framework.zend.com/svn/framework/standard/tags/release-1.9.3PL1/library/Zend

Step 5: Update the working copy again

svn up

You should now have the external repository files in your working copy.

Step 6: Commit the changes.

svn commit -m "added an external repository"

When the Zend Framework releases a new version repeat the above simple steps and set the appropriate svn:extrenal URL.

Isn't svn:externals a cool subversion feature?

Reference:
SVN Book externals definitions page.

About the author

Sudheer is an entrepreneur and software developer. Get more from Sudheer on Twitter.


Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>. The supported tag styles are: <foo>, [foo].

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
             ____     ____    ___    _     ____  
__ __ | _ \ / ___| ( _ ) | |_ / ___|
\ \ /\ / / | | | | | | _ / _ \ | __| \___ \
\ V V / | |_| | | |_| | | (_) | | |_ ___) |
\_/\_/ |____/ \____| \___/ \__| |____/
Enter the code depicted in ASCII art style.
By submitting this form, you accept the Mollom privacy policy.