tags:

views:

340

answers:

7

We have a single SVN repository with multiple related projects. Like so...

\repo
  \Project1
    \branches
    \tags
    \trunk
  \Project2
    \branches
    \tags
    \trunk
  \Project3
    \branches
    \tags
    \trunk

I would like to check out the trunk of each project into my workspace without the branches/tags folders.

\workspace
  \Project1
    \trunk
  \Project2
    \trunk
  \Project3
    \trunk

Is there a way to do this without checking each trunk out individually?

+4  A: 

Short answer: no.

Long answer: See http://svnbook.red-bean.com/en/1.5/svn.advanced.sparsedirs.html and do your checkouts in a looped script.

Autocracy
Not the answer I wanted to hear... :-( but thanks for the quick and accurate response any way. Looks like I'll be writing a script today.
Chris Nava
I found a batch file to automate the process. http://www.lostechies.com/blogs/hex/archive/2008/03/11/batch-file-to-checkout-all-root-level-project-trunks-in-a-subversion-repository.aspx
Chris Nava
+1  A: 

EDIT: check out the SVN Book for the sections below

Check out 2 different directories into two separate working copies:

$ svn checkout file:///tmp/repos/test  file:///tmp/repos/quiz
A  test/a
A  test/b
Checked out revision 2.
A  quiz/l
A  quiz/m
Checked out revision 2.
$ ls
quiz  test

Check out 2 different directories into two separate working copies, but place both into a directory called 'working copies':

$ svn checkout file:///tmp/repos/test  file:///tmp/repos/quiz working-copies
A  working-copies/test/a
A  working-copies/test/b
Checked out revision 2.
A  working-copies/quiz/l
A  working-copies/quiz/m
Checked out revision 2.
$ ls
working-copies
Shadi Almosri
A: 

I suspect you'll still have to tell it about (checkout) each individual trunk - but you can at least also checkout the workspace (to get all the projects, and so you can update etc globally) using sparse directories.

Marc Gravell
+1  A: 

You can use the -N option, which ignores subdirectories, You can run this the very first time you check out the sources:

svn co -N http://path/to/repo
cd repo
for f in Project1 Project2 Project3; do
  svn up -N $f
  svn up $f/trunk
done

And to update the trunks at a later time:

svn up repo/*/trunk

This works with all svn clients. If you're using a svn 1.5.x client, you can also have a look at "sparse directories", documented at svnbook.red-bean.com/en/1.5/svn.advanced.sparsedirs.html (I'm not allowed to post links yet :-C), which will allow you to run "svn update" in the repo directory.

sunny256
A: 

This did the trick nicely in bash. Note that I renamed the output folders to make Eclipse happier when importing the projects.

for f in `svn ls http://path/to/repo`; do svn checkout http://path/to/repo/${f}trunk $f; done
Chris Nava
A: 

I wrote a Java-based utility that finds all trunks within an arbitrarily-complex SVN repository and generates a simple shell scrip that checks them out in the same working copy using sparse directories.

Take a look at the source code http://github.com/thatha/svntrunks or the binary distribution http://github.com/thatha/svntrunks/downloads.

Ian
A: 

I just wrote up a script for this exact issue.

http://bringhurst.org/post/561501649/checking-out-multiple-projects-in-one-subversion-repo

It simply creates all of the necessary svn commands depending on what branch/tag (trunk is default) you want to checkout.

Jon Bringhurst