忽略 SVN 工作副本中的分支

发布于 2024-10-05 13:24:08 字数 364 浏览 0 评论 0原文

最近,我们制作了项目主干的第一个分支。主干相当大(几个 GB),这对服务器来说并不重要,因为分支是通过那里的有效链接创建的。然而,在客户端工作副本中,该项目现在确实占用了两倍的空间(我们所有的 WC 都来自存储库根)。

由于只有少数人真正需要该分支,其他人如何使用TortoiseSVN忽略(即不下载)所有分支?

用户仅检查主干(如下所示)不是这里的解决方案。我们的结构是这样的:

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

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

笨笨の傻瓜 2024-10-12 13:24:08

简短的解决方案 - 切换到 /trunk。所有除了 trunk 之外不需要任何其他东西的人都可以从 /root/trunk 而不是从 /root 签出。任何想要分支的人都应该在另一个目录中签出该分支。

更精细的解决方案 - 仅签出您需要的内容,但保持树结构。如果您想要拥有全部的自由,并且只使用您想要的那些,请按照以下步骤操作:

  1. 使用选项“仅直接子级”从根结帐
  2. 使用选项“完全递归”从根/主干结帐

如果有人想要检查某些特殊分支然后在前两个步骤之后:

  • 使用选项“仅直接子级”从根/分支签出 使用
  • 选项“完全递归”从该特殊分支签出

您可以在 SVN 好书的“稀疏目录"。

这个挑选分支的过程没有捷径。批处理文件和 TortoiseProc 除外。

编辑:如果您已经签出了整个存储库,现在您想排除某些内容以节省空间,请在您想要通过签出部门“排除”排除的文件夹上使用命令“更新项目以修订”。根据手册,此选项仅在更新中可用修订对话框。我想这就是为了这个目的。

首先在临时工作副本上尝试此操作。我个人从来没有这样做过。

更新:从 TortoiseSVN 1.7 开始,“签出”对话框有一个“选择项目”按钮,使您可以仅选择所需的文件夹并一步获取它们。 “将项目更新为修订版”对话框中也提供了相同的按钮。

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.

为你拒绝所有暧昧 2024-10-12 13:24:08

(从工作副本的根目录)

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

这将从工作副本中删除所有分支,并且将来的更新将不会下载它们。
想要查看分支的开发人员随后可以:

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

(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
风渺 2024-10-12 13:24:08

我希望你有一个像这样的结构:

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

如果是这样的话,那么用户可以简单地签出 http://server/repo/trunk 而不是 http://server/repo code>,当他们想在分支上工作时,他们可以将工作副本切换到 http://server/repo/branches/branch1

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.

与风相奔跑 2024-10-12 13:24:08

右键单击您不需要的文件夹,然后转到“更新到修订版...”。在弹出的对话框中,将更新深度设置为“排除”。 (注意,这似乎只适用于文件夹。)这会将其从工作副本中删除,但不会影响存储库。乌龟只会知道在更新期间不要尝试更新它。

为了撤消它,您可以右键单击父文件夹(或其父文件夹等)并选择“Repo Browser”。找到排除的文件夹,右键单击并选择“将项目更新为修订版本”。你会得到同样的对话框;这次,只需确保它显示“工作副本”

撤消签出子文件夹乌龟SVN

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

有深☉意 2024-10-12 13:24:08

如果人们必须将资源与代码一起下载,那么在项目 x 级别进行分支更为自然。在这种情况下,您不会遇到您所描述的问题。你有什么理由只分支你的一部分东西吗?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文