tags:

views:

332

answers:

6

I am about to move to SVN as my RCS of choice (after many years using CVS) and have a basic question...

I have a number of shared projects - code that I want to use with lots of different projects. Is it possible to 'link' these shared folders to the projects that need them, so checking out a project will also checkout the shared code?

For example, suppose my repository looks like this:

root
--project1
--project2
--shared
--smtp

When I checkout project1, I also want to checkout shared and smtp.

Back in my CVS days I would of used a Unix symbolic link in one of the project folders, but as my new SVN repository won't necessarily be hosted on a Unix box, I can't do the same.

+10  A: 

SVN Externals are what you want to do. The SVN book explains it in great detail here. That's one thing I love about SVN, the wonderful documentation.

davr
A: 

This is what svn "Externals" are for.

Greg Rogers
A: 

Yes, have a look at SVN Externals.

Dan Dyer
4 identical answers in the space of 14 seconds. Not bad...
Dan Dyer
Yep, and the third one accepted :)
Sunny
jamuraa clearly has a better, direct, answer though. Upvoted that one.
Jilles
A: 

Yes, this mechanism is called "externals". See the book.

Denis Bueno
A: 

SVN has a feature called "externals" which basically works the same way a symbolic UNIX link works (you point a certain directory that's one place in your repository to some other directory elsewhere in your repository).

For further info on how to setup externals, see this: http://svnbook.red-bean.com/en/1.0/ch07s03.html

Hope that helps.

machineghost
+2  A: 

You are looking for the "svn:externals" property. See this section of svnbook:

Under the project that you want to use the shared project in, and then set a property on that directory named "svn:externals". This property contains the name of the directory which contains the external respository, and can have some other options so that you always get the same revision.

Example (from svnbook, which is an EXCELLENT reference for svn questions):

$ svn propget svn:externals calc
third-party/sounds             http://svn.example.com/repos/sounds
third-party/skins -r148        http://svn.example.com/skinproj
third-party/skins/toolkit -r21 http://svn.example.com/skin-maker

in this example, third-party/sounds would be checked out from http://svn.example.com/repos/sounds. The -rNNN pins the checkout to a revision so that if you're doing more development on that, you can make sure your other projects don't randomly break. Generally instead of doing this revision thing, I external to a tag which holds a stable version.

jamuraa