Checkout full Subversion tree excluding tags / branches /

I am working on a corporate source tree containing 100 Maven subprojects. Since each subproject has its own subtext layout branches/

and tags/

, the whole tree is laid out like this:

root/
    some/intermediate/dirs/
        project1/
            branches/
                ...
            tags/
                ...
            trunk/
                ...
        project2/
            branches/
                ...
            tags/
                ...
            trunk/
                ...
        ...
        projectN/
            branches/
                ...
            tags/
                ...
            trunk/
                ...
    other/intermediate/dirs/
        projectN+1/
            ...

      

I need to check versions of trunk/

all projects, but unfortunately the team $ svn co protocol://path/to/repo/root/

checks out full versions of tags and branches, leaving me with thousands of redundant source trees and taking forever .

Also, it N

is a very large number, and it is almost impossible for me to go in and check each project connection port individually.

Is there a command svn

that will allow me to skip trees tags/

and branches/

?

I found a blog that explains how to write a Java program to do this using SVNKit , but I was hoping I could do it using a single liner from the command line.

Refresh . A solution using only executables svn

is preferred, but if any shell script is required, I would prefer the Windows batch script, or otherwise any bash

or the zsh

script will ...

+3


source to share


3 answers


You need sparse SVN directories .

You will need a skeleton structure and only fill in trunk

when you get to them. Something like (Bourne shell syntax):

svn co --depth empty protocol://path/to/repo/root/
for in in some intermediate dirs; do svn up --set-depth empty $i; cd $i; done
svn up --depth immediates .
for i in *; do svn up --depth infinity $i/trunk; done

      



I am assuming that none of the directories mentioned contain spaces or shell metacharacters - add relevant quotes if necessary.

Beware when using sparse directories - it's easy to lose track of what is excluded and what doesn't really exist ...

+7


source


I don't know what output format you need, but this line might help:

dir /s /b /ad |findstr /v /R "\<tags\>  \<branches\>"

      

findstr

can search for "words" using "\<word\>"

, so moretags

either tagsmore

will not be excluded. Cm.findstr /?



or if you are only interested in * trunk subdirectories:

dir /s /b /ad |findstr  "\<trunc\>" 

      

0


source


Instead, --set-depth empty

I found a suggestion to use -set-depth=exclude

. Fe:

svn update --set-depth=exclude <foldername>

      

It is much more convenient. If in your example you do in a directory some/intermediate/dirs/project1/

:

svn up --set-depth empty tags

      

And then:

svn up

      

The catalog tags

will reappear and all content will be downloaded. Therefore, you only need updates from descendant directories.

But with:

svn update --set-depth=exclude tags

      

The directory will be deleted and you can svn up

even do from the directoryroot/

! The update will only come to the catalogs that you left!

To restore the original state and get back all the directories deleted in this way, you can do:

svn up --set-depth infinity .

      

0


source







All Articles