1

I have a project with a directory structure like this:

project
|--source
|--fgh
|--...
|--ijk
`--tests
   |--abc
   |--cde
   |--...
   |--utils

I want to checkout the source and tests/utils directories (and everything inside recursively). Remainder directories (like abc, cde, ...) should not be checked out since they are huge.

I think svn co --depth empty is what I'm looking for. But then how to check out only tests/utils if test doesn't exist after the checkout is done?

zb226
  • 9,586
  • 6
  • 49
  • 79
Kamil
  • 506
  • 4
  • 9
  • 21
  • JFYI: Dry theory from [SVN Book](http://svnbook.red-bean.com/en/1.8/svn.advanced.sparsedirs.html) ("how and why?") – Lazy Badger Oct 18 '16 at 23:25

1 Answers1

1

You are on the right track - do it like this:

svn co [REPO-URL] --depth emtpy
svn up [PROJECT]/source --depth infinity
svn up [PROJECT]/tests --depth empty
svn up [PROJECT]/tests/utils --depth infinity

Edit: LazyBadger is arguing that "--set-depth for svn up will be more correct way". Well, the SVN documentation quite clearly states for the --set-depth option (emphasis mine):

It is with this option that you can change the sticky depth of a working copy item.

However in this case, we are not changing any previously checked out working copy item - We're building a (sparse) working copy from scratch, step by step. So why would --set-depth be more correct? It isn't. But for completeness, if you'd like to type a bit more, you could also do:

svn co [REPO-URL] --depth emtpy
svn up [PROJECT]/source --set-depth infinity
svn up [PROJECT]/tests --set-depth empty
svn up [PROJECT]/tests/utils --set-depth infinity
Community
  • 1
  • 1
zb226
  • 9,586
  • 6
  • 49
  • 79