views:

6804

answers:

7

Can I ignore a folder on svn checkout? I need to ignore DOCs folder on checkout at my build server.

edit: Ignore externals isn't an option. I have some externals that I need.

+1  A: 

No, ignore is only for adding files.
You can use sparse checkouts (if you use svn 1.5)

Peter Parker
+4  A: 

Yes, Subversion 1.5 has a feature called Sparse checkouts that can do exactly this sort of thing.

Greg Hewgill
From reading that, it looks like sparse checkouts only limit the depth of a checkout. They can't ignore one particular folder.
John Millikin
Sure, you might have to do a little extra legwork, like limit the depth of the parent folder with --depth immediates, then check out all the other folders except the one you would like to ignore. The point is, the tools are there if you need to use them.
Greg Hewgill
+1  A: 

You could put the docs folder in an external repository and then use svn checkout --ignore-externals.

John Millikin
This is what we ended up doing to skip some pre-built components in a previous job.
Mark Bessey
+1  A: 

As a few others have mentioned, you can just use svn:externals properties and then the --ignore-externals option when you checkout. One thing to note, however, is that svn:externals does not necessarily need to refer to another repository. It can be a reference to some other folder in the same repo.

Nik Reiman
A: 

Ignore externals isn't an option. I have some externals that I need.

Zote
It might be better for posterity for you to include this comment in your question, rather than it its own answer.
JXG
+14  A: 

You can't directly ignore folders on a checkout, but you can use sparse checkouts in svn 1.5. For example:

$ svn co http://subversion/project/trunk my_checkout --depth immediates

This will check files and directories from your project trunk into 'my_checkout', but not recurse into those directories. Eg:

$ cd my_checkout && ls
bar/ baz foo xyzzy/

Then to get the contents of 'bar' down:

$ cd bar && svn update --set-depth infinity
Jon Topper
+3  A: 

With versions prior to 1.5 I have found that if you checkout only the top most folder and then selectively update, from then on updates only effect what you have checked out. Ie.

svn co -N foo
cd foo
svn up -N bar
svn up

The -N flag makes the operation non-recursive. The above will not check out anything else at the foo level, eg. say there is a folder lala, the final svn up will not check out that folder, but it will update bar.

But at a later time you can svn up lala and thus, add it to the checkout.

Presumably this also works with 1.5.

Max Howell