tags:

views:

3847

answers:

6

If I had 20 directories under trunk/ with lots of files in each and only needed 3 of those directories, would it be possible to do a Subversion checkout with only those 3 directories under trunk?

+2  A: 

Or do a non-recursive checkout of /trunk, then just do a manual update on the 3 directories you need.

zigdon
A: 

Not in any especially useful way, no. You can check out subtrees (as in Bobby Jack's suggestion), but then you lose the ability to update/commit them atomically; to do that, they need to be placed under their common parent, and as soon as you check out the common parent, you'll download everything under that parent. Non-recursive isn't a good option, because you want updates and commits to be recursive.

DrPizza
+1  A: 

Sort of. As Bobby says:

svn co file:///.../trunk/foo file:///.../trunk/bar file:///.../trunk/hum

will get the folders, but you will get separate folders from a subversion perspective. You will have to go separate commits and updates on each subfolder.

I don't believe you can checkout a partial tree and then work with the partial tree as a single entity.

Rob Walker
+13  A: 

Yes, to elaborate on @zigdon's answer, you could do something like this:

svn checkout --non-recursive http://svnserver/trunk/ proj
svn update trunk/foo
svn update trunk/bar
svn update trunk/baz

Indeed, thanks to the comments to my post here, it looks like sparse directories are the way to go. I believe the following should do it:

svn checkout --depth empty http://svnserver/trunk/ proj
svn update --set-depth infinity proj/foo
svn update --set-depth infinity proj/bar
svn update --set-depth infinity proj/baz
pkaeding
If I then issue a svn update on the trunk directory will it pull down all the other folders, or just update the ones that have already been retrieved?
Rob Walker
@Rob: I don't know about sparse checkouts, but the non-recursive method of above will only checkout those you added via update later on and those that were not present when you did the initial checkout.
Mecki
+13  A: 

Subversion 1.5 introduces sparse checkouts which may be something you might find useful:

http://svnbook.red-bean.com/nightly/en/svn.advanced.sparsedirs.html

Richard Morgan
A: 

@Richard

Oh, now that seems to solve a lot of the problems. It seems that they added a lot of good stuff in 1.5; I'm amazed it's not 2.0, really.

DrPizza