问题描述
我有一个以DOS批处理文件形式出现的本地自动构建脚本.在该脚本的一部分中,我检出(带有"svn checkout")SVN存储库的一部分,其中包括一堆用于项目中的第三方内容.很长一段时间以来,该批处理文件的性能都很好,但是现在人们已经将大量的绒毛(文档,示例代码等)检入到第三方区域中,并且此脚本的检出部分的速度变慢了很多.我想通过仅检查我们需要的东西(在我们的情况下主要是dll文件)来减轻这种情况.所以,我的问题是:检出按文件扩展名过滤的SVN存储库的最佳方法是什么?
I have a home-grown automated build script in the form of a DOS batch file. In part of that script, I check out (with "svn checkout") a section of our SVN repository that includes a bunch of third-party stuff that's used in our projects. This batch file performed pretty well for a long time, but now people have checked in lots of fluff (docs, sample code, etc.) into the third-party area and the checkout part of this script has gotten lots slower. I'd like to mitigate this by checking out only the stuff we need -- mostly dll files in our case. So, my question is this: what's the best way to check out an SVN repository filtered by file extension?
在svn帮助中,我没有发现任何明显的方法.我有一个.NET实用程序库,它以某种方式包装svn.exe,并且我正在考虑对其进行扩展,以仅检索与我感兴趣的扩展名匹配的内容.但是我更喜欢使用一种更简单或现有的方法.
I didn't see any obvious way to do this in the svn help. I have a .NET utility library that wraps svn.exe in some ways, and I was thinking of extending this to retrieve only content that matched my extensions of interest. But I'd prefer to use an easier or existing method if one exists.
推荐答案
这是可能的:您可以svn checkout
一个空目录,然后为要做的每个文件svn update filename
.
This is possible: you can svn checkout
an empty directory, and then svn update filename
for each file that you do want.
您的脚本可以执行以下操作:
Your script can do something like:
-
svn checkout svn://path/to/repos/directory --depth empty
-
svn list --recursive svn://path/to/repos/directory
- 通过过滤器清除掉禁止的文件扩展名,例如
grep
- 遍历此新过滤列表,并
svn update --parents
每个文件
svn checkout svn://path/to/repos/directory --depth empty
svn list --recursive svn://path/to/repos/directory
- Pipe that result through a filter that removes the forbidden file extensions, e.g.
grep
- Iterate over this new filtered list and
svn update --parents
each file
这将为您提供不需要某些文件或文件扩展名的工作副本的理想结果.
That would give your desired result of a working copy without certain files or file extensions.
当然,您还提到了人们[检查]大量绒毛"的问题,但这是另一回事.
Of course, there is also the issue that you mention of "people [checking] in lots of fluff" but that’s a separate matter.
这篇关于SVN结帐是否以文件扩展名过滤?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!