Repository organization and selective checkout
I am using TortoiseSVN and I have a SVN repository organized in this开发者_如何学Go way:
folder1
folder2
trunk
tag
branches
folder3
trunk
tag
branches
folder4
folder5
trunk
tag
branches
I would like to know if there is a way to checkout only trunk directories, keeping the entire tree under the versioning control:
folder1
folder2
trunk
folder3
trunk
folder4
folder5
trunk
In this way I can update all trunks with a single update command on folder1
, without updating tags and branches which can be full of data.
This issue had been bothering me, and I cracked it :)
svn up --set-depth empty branches
svn up --set-depth empty trunk
subsequent calls to svn update
in parent directories will not update these directories, nor will calls to svn commit
.
If you were going to check this out afresh, you could:
svn co --depth empty <folder1 svn url>
cd folder1
svn up --depth empty folder2
cd folder2
svn up trunk
and then repeat for each folder3
and folder4
Please note, that sparse checkouts are usually the way to go, however Subversion will not allow you to merge with --reintegrate option.
This may sound as a minor problem(eg if you are single user), but you really should think over it and use a proper repository structure.
Your mentioned repository structure will also not allow to tag or branch all project at once.
The closest and easiest might be sparse checkouts. That would give you
folder1
folder2
trunk
A
B
C
...
tag
branch
folder3
trunk
A
B
C
...
tag
branch
folder4
folder5
trunk
A
B
C
...
tag
branch
and the ability to update all in one go.
Or you do this using externals. Create a new folder in your repository which does nothing but refer to other trunks.
There are two ways to do this.
- Switch the unneeded directories to empty ones. For that you have to have an empty directory somewhere in your repository. Then you first checkout the whole tree, then do
svn switch svn://foo/bar/path/to/empty/dir folder1/folder2/tags svn switch svn://foo/bar/path/to/empty/dir folder1/folder2/branches
etc.
- Starting with 1.5, you can use sparse directories.
精彩评论