Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
729 views
in Technique[技术] by (71.8m points)

svn - How to checkout few files and folders alone without checking out entire source

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
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...