Setting up svn:externals

Problem

You have two repositories (projects) that share some content. For example that content could be some libraries, plugins, etc, but both projects depend on this data. And certainly you don't want to duplicate efforts by making changes on both repositories. A solution is to use svn:externals... this will create "link" among the shared location in your repositories, allowing your working copies to work/use it as desired

From SVN book Externals Definitions:

"An externals definition is a mapping of a local directory to the URL—and possibly a particular revision—of a versioned resource. In Subversion, you declare externals definitions in groups using the svn:externals property.

....

The convenience of the svn:externals property is that once it is set on a versioned directory, everyone who checks out a working copy with that directory also gets the benefit of the externals definition. In other words, once one person has made the effort to define those nested working copy checkouts, no one else has to bother—Subversion will, upon checkout of the original working copy, also checkout the external working copies."

Setting svn:externals with TortoiseSVN:

  1. On your working copy, right click on a folder (this will be the parent folder of your external) > TortoiseSVN > Properties
  2. On the Properties window: Click New
    • Property Name: svn:externals (select from the dropdown menu)
    • Property Value type: "myExternalFolderDestination https://myorg.svn.cloudforge.com/myproject/path/to/external/origin"
    • The myExternalFolderDestination will be created inside the parent folder from step 1 and will be pointing to the origin location in the URL above
  3. Commit your changes > Do an update to pull the external to your working copy

 

Screen_shot_2010-06-21_at_6.11.03_PM.png

 

On Eclipse with Subclipse:

  1. On your working copy, right click on a folder (this will be the parent folder of your external) > Team > Set Property
  2. On the Set Property window:
    • Property Name: svn:externals (select from the dropdown menu)
    • Property content > Enter a text Property: "myExternalFolderDestination https://myorg.svn.cloudforge.com/myproject/path/to/external/origin" 
    • The myExternalFolderDestination will be created inside the parent folder from step 1, and will be pointing to the origin location in the URL above
  3. Commit your changes > Do an update to pull the external to your working copy

 

Screen_shot_2010-06-21_at_5.02.38_PM.png

 

On Command Line:

# cd path/to/workingcopy/parentofexternal/folder

# svn propset svn:externals 'myExternalFolderDestination https://myorg.svn.cloudforge.com/myproject/path/to/external/origin' .

# svn commit -m "adding external"

# svn update

 

Notes

In order to successfully checkout the repository including the external, the user needs to have access to both repositories locations. The username and password for access again need to be same for both locations.

You could potentially, use an origin repository location for your external that's is not necessarily hosted on CloudForge, however, the username and password for the remote origin location has to be the same as the one in CloudForge. Otherwise, the checkout will completed, but it will skip the remote locations that could access due to the difference in login details.

Have more questions? Submit a request

0 Comments

Article is closed for comments.