开发者

SVN: How do I checkout entire source tree with trunks only?

Two-parter, really:

  1. How do I checkout an entire source tree but on开发者_如何学JAVAly get the trunks of everything, ignoring all branches and tags?

  2. Assuming #1 is doable, is there a way to have there not be any "trunk" directories, and just have the files reside in a folder with the name of the repository?


Most SVN repostiories are structured something like this:

/
|-- /branches
|-- /tags
`-- /trunk
    |-- foo
    `-- bar

So if the root of the repository is at http://www.example.com/svn, you can run

svn co http://www.example.com/svn/trunk

to check out just the trunk. If you want to name the checked-out folder after the project, just add the project name to the command line:

svn co http://www.example.com/svn/trunk myproject

This command should produce a directory structure like:

myproject/
|-- foo
`-- bar


No, it's not possible. What you can do is to create a new project add define external links from it to every other projects trunks. External link works like softlink.

You can then chekout everything in one step.

http://svnbook.red-bean.com/en/1.0/ch07s03.html


Provided all folders have identical root-structure you can use this batch command in Windows to check out all trunk folders from the root:

for /F %%A IN ('svn list <your root URL here>') do svn co <your root URL here>/%%Atrunk ./%%A


This script creates a subscript with all checkout commands of the underlying projects (depth is DEVELOPMENT -> FOLDER -> SVN PROJECTS)

#!/bin/bash

PROJECTS=`svn list http://svn-server/svn/hps/Development/`

IFS=$'\n' 
for i in $PROJECTS; do
 REPOS=`svn list http://svn-server/svn/hps/Development/$i`
 for r in $REPOS; do
  echo "svn checkout \"http://svn-server/svn/hps/Development/${i}${r}trunk\" \"${r}\"" >> checkout_all_svn_trunk_cmd.sh
 done;
done;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜