Map svn inside another svn with svn:externals. Example with Zend Framework and Netbeans

SVN supports external definitions.

Basically, it allows to map a subdirectory of our SVN working copy to an URL of another SVN repository. See the link above for more details.

That’s can be useful for example to mount zend framework libraries in our repository, in order to have a smaller and faster svn as well as an automatic update of the libraries directly from the Zend repositories (instead of download them again and add to the working copy, that is a very long process with the ~3k ZF files).

Requisites
The mapped directory must not exist in the local svn, and the parent directory must already by committed.  For instance, if the standard ZF app structure is followed, commit the “/library” folder with no “Zend” folder inside, then map “library/Zend” to the SVN URL that contains that folder.

Set the SVN property with netbeans

Right click on the root directory, than “Subversion”, “Svn Properties”. Property name

svn:externals

value

trunk/library/Zend http://framework.zend.com/svn/framework/standard/branches/release-1.10/library/Zend

Note: “trunk/library/Zend” is the relative path starting from the root directory (the one you set the property on). Example: if you set the property to the “library” folder, specify only “Zend”.

Do a commit to set the property, then update the copy to get the files from the repository to the mapped directory. Of course it’s not possible to commit changes inside the zend libraries if you have no permission to write in the zend repository.

Set property with command line

I have not tested, but according to documentation, the command to launch is
svn propedit svn:externals .
The default editor should be launched, write inside the value specified above.

In case of wrong mapping

I did some wrong mapping at the beginning and I don’t remember how I solved. It took quite a lot when dealing with zend libraries as they contain a lot of files. In case you have the same problem, avoid using netbeans as it tends to scan the code at every file removed and it’s really slow for this kind of changes.
To remove the mapping, it should be enough to edit the property and commit again. In case of problem, checkout again the repository omitting external, than change the property and update to get the external svn.