开发者

Repository organization and selective checkout

开发者 https://www.devze.com 2022-12-23 12:13 出处:网络
I am using TortoiseSVN and I have a SVN repository organized in this开发者_如何学Go way: folder1

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.

  1. 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.

  1. Starting with 1.5, you can use sparse directories.
0

精彩评论

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

关注公众号