2
votes

I'm reading the red bean SVN book, and it says to layout trunk, branches, and tags folders like so:

$ svn list file:///var/svn/multi-project-repo
project-A/
project-B/
$ svn list file:///var/svn/multi-project-repo/project-A
trunk/
branches/
tags/
$ svn list file:///var/svn/multi-project-repo/project-B
trunk/
branches/
tags/
$

Now, that's all well and good, but what if I want to make a local working copy of just the trunk folders for project-A and project-B. If I update with the URL pointing to "multi-project-repo", I will additionally get the branches and tags folders that I don't need. Is what I'm asking unreasonable (getting only the trunk files) or am I being reasonable, and is there an easy way to do this?

4

4 Answers

3
votes
svn co http://mycompany.com/svn/Projects/Project1/trunk ./project1-trunk

That'll put a working copy of Project1/trunk in the local directory ./project1-trunk. There's nothing inherently special about any of the directories -- as far as SVN cares, they're just directories, and you can copy any one of them.

3
votes

Another option (also in the svnbook) is to have one set of trunk, tags, and branches.

In the name of full disclosure, though, we'll mention another very common layout. In this layout, the trunk, tags, and branches directories live in the root directory of your repository, and your projects are in subdirectories beneath those, like so:

/
   trunk/
      calc/
      calendar/
      spreadsheet/
      …
   tags/
      calc/
      calendar/
      spreadsheet/
      …
   branches/
      calc/
      calendar/
      spreadsheet/
      …

This is another common layout, and might make more sense if the projects are more closely related or worked with together.

In this case, get the trunk, you get all of the projects. This is how we have our repository set up.

1
votes

Use the URL to the repository directory you care about. If you want the "trunk" directory, check out that subdirectory, not the entire repository.

Keep reading!

0
votes

Assuming you are using mentioned layout and want to checkout all the trunks of all the projects with one command, consider the following technique:

  1. Create an additional project in SVN, e.g. call it all-trunks:

    svn mkdir file:///var/svn/multi-project-repo/all-trunks
    
  2. Make a working copy of all-trunks:

    svn co file:///var/svn/multi-project-repo/all-trunks
    
  3. Edit svn:externals property of the working copy of all-trunks to add all the project trunks you have:

    svn propedit svn:externals .
    ...
    ^/project-A/trunk project-A
    ^/project-B/trunk project-B
    ...
    
  4. Commit:

    svn ci
    

Now every time you want to get a working copy with trunks of all the projects you'll only need to checkout the all-trunks:

svn co file:///var/svn/multi-project-repo/all-trunks

Every time you create a new project don't forget to add it to svn:externals.

You can write a script that gets a list of all the projects svn ls file:///var/svn/multi-project-repo (excluding all-trunks) and builds a command to update svn:externals of all-trunks.