简体   繁体   中英

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

Two-parter, really:

  1. How do I checkout an entire source tree but only 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

如果所有文件夹都具有相同的根结构,则可以在Windows中使用此批处理命令从根目录中检出所有主干文件夹:

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;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM