22

In my project I have many folders. I certainly know I want have changes in only few files (around 15) each of them are in 7 different folders. Also, I don't want to checkout the entire source to accomplish it. Is it possible to checkout only the required folders alone?

I'll have this scenario too often for different sources. Is it possible to checkout only selected folders at one shot?

Edit

Say for example I have a source folder contains. 5 sub-folders. Like,

source

-- Core

-- Helper

-- Extensions

-- Themes

-- Resources

And, I want to check-out Extensions and Themes folders alone. But, I don't want to check-out each of the folders separately. I want it like, I'll give the check-out location as svn.svnhost.com/trunk/project1/source. [Then, I'll select Extensions and Themes give a single check-out]

Expected Checkout:

source

-- Extensions

-- Themes

Some thing like:

svn co svn.svnhost.com/trunk/project1/source --foldernames Extensions, Themes
Zoe
  • 27,060
  • 21
  • 118
  • 148
Prince Ashitaka
  • 8,623
  • 12
  • 48
  • 71

4 Answers4

26

Apart from just checking out the folders you want (which only works if you want the entire subfolder tree as well), Subversion 1.7 supports something referred to as "sparse directories". Basically you can checkout a folder to a certain depth, and then afterwards "drill down" into the folders you are interested in.

Using the command line client, you use the --depth and --set-depth options to svn update. If you are using TortoiseSVN, there is a "Checkout Depth" option in the checkout dialog.

EDIT: To clarify against your specific question, you would first to a checkout of your source tree with depth "immediates". This will give you all your folders, but they will initially be empty. Then you can drill down in the Extensions and Themes directories by updating them to "fully recursive" depth (svn update --set-depth infinity or in TortoiseSVN "Update to revision → Update Depth → "Fully Recursive").

EDIT: The update depth can be seen as a sort of "visibility level", and is remembered by Subversion, i.e. if you do a svn update on your working copy, it will only update to the current visibility level.

Sebas
  • 21,192
  • 9
  • 55
  • 109
JesperE
  • 63,317
  • 21
  • 138
  • 197
  • @JasperE But, I cannot do this with a single svn command right? No matter, the above mentioned method `immediates` itself saves much time. :) – Prince Ashitaka Oct 27 '10 at 12:12
  • No, you need multiple commands. OTOH, you can apply this technique recursively if you for example just want to checkout parts of the Extensions or Themese directories. – JesperE Oct 27 '10 at 12:22
  • This is actually a pretty cool feature, although it hasn't really suited my situation really well. Also, you cannot **reduce** the visibility level; so if you have set the depth to infinity, there is no way to reduce it (pruning) without checking out everything again. – JesperE Oct 27 '10 at 12:24
  • @JasperE Thanks :). I'll write a check-out utility atleast to ease the process. Thanks again. – Prince Ashitaka Oct 27 '10 at 12:32
  • 2
    JesperE: The manual says you cannot reduce the visibility level, but with svn 1.6 that's no longer true: Something like "svn up --set-depth exclude foobar" actually does work now. – slowdog Oct 27 '10 at 19:40
6

I know this question is more than 5 years old, but my answer may help those who are look at this question now.

I'm using tortoise SVN verion 1.9, it has an option "choose items" before checkout. We can choose required folders / files to checkout from the repository browser.enter image description here

Kira
  • 1,403
  • 1
  • 17
  • 46
5

Yes, See if you have an Repository address like:

https://elastik.svn.sourceforge.net/svnroot/elastik/

Simply add the folder you want on to the end. So if I only want the "trunk/includes" folder:

https://elastik.svn.sourceforge.net/svnroot/elastik/trunk/includes
James
  • 3,265
  • 4
  • 22
  • 28
1

In the Tortoise navigator (right click) navigate to a specific folder and perform checkout against the location

Alan Stephens
  • 569
  • 5
  • 14