Daniel Sloof
Daniel Sloof

Reputation: 12706

Subversion; checking out only trunk for multiple projects

I have a directory structure in svn like this:

...

I want to checkout only trunk directories for all these projects. There are about 400 of these kind of projects so checking out trunk manually won't be an option.

My first guess would be to use svn list, but my shell scripting skills are not up to par and I'm sure how to create the appropriate directories and append 'trunk' and do a checkout.

Anyone willing to point me in the right direction?

TL:DR;

Upvotes: 1

Views: 1758

Answers (2)

Mick
Mick

Reputation: 31

Here is a way to do it by using the depth flag:

echo Getting Projects the folder structure
svn co http://www.therepo.com/projectsParentFolder --depth immediates

echo Getting the structure for each Project
for /f %%f in ('dir /b .\projectsParentFolder') do svn co http://www.therepo.com/projectsParentFolder/%%f .\projectsParentFolder\%%f --depth immediates

echo Getting the trunk for each Project
for /f %%f in ('dir /b .\projectsParentFolder') do svn co http://www.therepo.com/projectsParentFolder/%%f/trunk .\projectsParentFolder\%%f\trunk --depth infinity

Upvotes: 0

Eugene Yarmash
Eugene Yarmash

Reputation: 149736

You can store the list of projects to a file (projects_list), then run this script:

for p in $(cat projects_list); do
    mkdir $p
    svn co "$url/$p/trunk" $p
done

Upvotes: 2

Related Questions