OmegaDelta.net

Hong Kong

SVN – partial checkouts

I have a project setup like this:

trunk/Project1
trunk/Project2

I wanted to add a common library to both projects.  Turns out there is a really nice way of doing this.

Add the library to trunk/Library

Then do a selective checkout.  Simply check out the trunk using --depth=empty (docs).  Then in this directory (which is a working copy with a .svn), you “svn update” the various directories you do want.  In this case, ‘svn update Library’ and ‘svn update Project1′.  You now have a perfectly valid, single working copy with just the libraries you need.

SVN also now has relative externs (since 1.5) so you could extern to ../Library which then still plays nice when you branch the trunk.  Only catch – it’s still an extern which requires separate committing and merging.  Less than ideal.  Still is it a hell of a lot better than absolute externs which require updating every time you branch as well.  I went with the partial checkout solution above, I think it’s neater, but it is nice to have the choice now.

Leave a Reply