您可以使用 Subversion 进行部分结帐吗?
如果我在 trunk/ 下有 20 个目录,每个目录中有很多文件,并且只需要其中的 3 个目录,是否可以仅使用 trunk 下的这 3 个目录进行 Subversion 签出?
If I had 20 directories under trunk/ with lots of files in each and only needed 3 of those directories, would it be possible to do a Subversion checkout with only those 3 directories under trunk?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
事实上,由于对我的帖子的评论,它看起来像 稀疏目录 是正确的选择。 我相信以下应该做到这一点:
或者,
--深度立即数
而不是empty
检查trunk/proj
中的文件和目录,而不带其内容。 这样您就可以看到存储库中存在哪些目录。正如 @zigdon 的回答中提到的,您还可以进行非递归结帐。 这是一种较旧且不太灵活的方法来实现类似的效果:
Indeed, thanks to the comments to my post here, it looks like sparse directories are the way to go. I believe the following should do it:
Alternatively,
--depth immediates
instead ofempty
checks out files and directories intrunk/proj
without their contents. That way you can see which directories exist in the repository.As mentioned in @zigdon's answer, you can also do a non-recursive checkout. This is an older and less flexible way to achieve a similar effect:
Subversion 1.5 引入了稀疏结帐,这可能对您有用。 来自文档:
Subversion 1.5 introduces sparse checkouts which may be something you might find useful. From the documentation:
我编写了一个脚本来自动执行复杂的稀疏结账。
I wrote a script to automate complex sparse checkouts.
或者对 /trunk 进行非递归签出,然后对您需要的 3 个目录进行手动更新。
Or do a non-recursive checkout of /trunk, then just do a manual update on the 3 directories you need.
如果您已经拥有完整的本地副本,则可以使用
--set-depth
命令删除不需要的子文件夹。请参阅:http://blogs.collab.net/subversion/sparse- directories-now-with-exclusion
set-depth
命令支持多个路径。更新根本地副本不会更改已修改文件夹的深度。
要将文件夹恢复为重复签出,您可以再次使用带有无穷大参数的
--set-depth
。If you already have the full local copy, you can remove unwanted sub folders by using
--set-depth
command.See: http://blogs.collab.net/subversion/sparse-directories-now-with-exclusion
The
set-depth
command support multipile paths.Updating the root local copy will not change the depth of the modified folder.
To restore the folder to being recusively checkingout, you could use
--set-depth
again with infinity param.我为那些使用 TortoiseSvn 工具的用户添加此信息:要获得 OP 相同的功能,您可以使用 Checkout Depth 部分中的
Choose items...
按钮Checkout 功能,如下图所示:I'm adding this information for those using the TortoiseSvn tool: to obtain the OP same functionality, you can use the
Choose items...
button in the Checkout Depth section of the Checkout function, as shown in the following screenshot:有点。 正如鲍比所说:
将获得文件夹,但从颠覆的角度来看,您将获得单独的文件夹。 您必须对每个子文件夹进行单独的提交和更新。
我不相信您可以签出部分树,然后将部分树作为单个实体使用。
Sort of. As Bobby says:
will get the folders, but you will get separate folders from a subversion perspective. You will have to go separate commits and updates on each subfolder.
I don't believe you can checkout a partial tree and then work with the partial tree as a single entity.
不是以任何特别有用的方式,不。 您可以检查子树(如 Bobby Jack 的建议),但随后您将失去以原子方式更新/提交它们的能力; 为此,它们需要放置在其共同父级下,并且一旦您签出共同父级,您将下载该父级下的所有内容。 非递归不是一个好的选择,因为您希望更新和提交是递归的。
Not in any especially useful way, no. You can check out subtrees (as in Bobby Jack's suggestion), but then you lose the ability to update/commit them atomically; to do that, they need to be placed under their common parent, and as soon as you check out the common parent, you'll download everything under that parent. Non-recursive isn't a good option, because you want updates and commits to be recursive.