Question

I have a directory structure in svn like this:

  • Project A
    • branches
    • tags
    • trunk
  • Project B
    • branches
    • tags
    • trunk

...

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;

  • svn list produces something like 'project_a'.
  • I want to checkout 'project_a/trunk' into 'project_a'.
Was it helpful?

Solution

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

OTHER TIPS

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
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top