开发者

Ignore branches in SVN working copy

Recently we made the first branch of our project's trunk. The trunk is rather large (severals GB's) which doesn't matter for the server, because the branch is made via efficient linking there. In the cli开发者_开发知识库ent working copies however, the project now really does take twice the amount of space (all our WC's are from the repository root).

Since only a few people really need the branch, how can the others ignore (i.e. not download) all the branches using TortoiseSVN?

Users only checking out trunk, as suggested below, is not the solution here. Our structure is as such:

/
 projects
  project-x
   assets
    blabla.psd
   code
    trunk
    branches
     branch1
     branch2
  project-y
   ...


Short solution - switch to /trunk. All who don't need anything else but trunk can just checkout from /root/trunk instead from /root. Anyone who wants a branch should just checkout the branch in another directory.

More elaborate solution - checkout only what you need but maintain tree structure. If you want both the freedom to have it all, and use only those you want then follow these steps:

  1. checkout from root with option "immediate children only"
  2. checkout from root/trunk with option "full recursive"

If someone wants some special branch checked out then after previous two steps:

  • checkout from root/branches with option "immediate children only"
  • checkout from that special branch with option "full recursive"

You can find more on the subject in SVN good book, chapter "Sparse Directories".

There is no shortcut to this procedure to cherry-pick branches. Except for batch file and TortoiseProc.

EDIT: If you already have the whole repository checked out, and now you want to exclude something to save space, use command "Update item to revison" on folder you want excluded with checkout dept "Exclude". According to the manual this option is only available in the Update to revision dialog. I guess it is meant for just this purpose.

Try this first on temporary working copy. I've never done this personally.

UPDATE: From TortoiseSVN 1.7 Checkout dialog has a button "Choose items" that enables you to select only the wanted folders and fetch them in single step. Same button is also available in "Update item to revision" dialog.


(from the root of your working copy)

find . -name branches -exec svn update --set-depth empty {} \;

This will remove all branches from your working copy, and future updates will not download them. Developers who want to see a branch can subsequently:

svn update --set-depth infinity branches\my-feature-branch


I hope you have a structure something like this:

repo root
  |
  +-- trunk
  |
  +-- branches
         |
         +-- branch1
         +-- branch2
         +-- ...

If that's the case, then users can simply checkout http://server/repo/trunk instead of http://server/repo, and when they want to work on the branch instead, they can switch their working copies to http://server/repo/branches/branch1.


Right click the folder that you don't want to and go to "Update to revision...". In the dialog that pops up, set the Update Depth to "Exclude". (Note, this only seems to work for folders.) That will remove it from your working copy, but won't affect the repository. Tortoise will just know not to try and update it during updates.

In order to undo it, you can right-click the parent folder (or its parent, and so on) and pick "Repo Browser". Find the excluded folder, right-click and pick "Update item to revision". You'll get that same dialog; this time, just make sure it says "Working copy"

Undo check out of subfolder in TortoiseSVN


If people have to download assets together with code, it's more natural to branch on level of project-x. In this case you will not have problems you describe. Do you have any reasons to branch only part of your stuff?

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜