使 SVN 工作文件夹与存储库版本相同
我基本上想将 SVN 导出作为脚本化构建过程的一部分,但不必每次都从头开始获取整个存储库,这很慢并且会占用带宽......更不用说会让测试脚本变得很痛苦如果每次我们调整某些内容或发现脚本中的拼写错误时它都会这样做。
是否有一种明显的方法可以导出到现有目录,以便仅获取不同的文件,并删除非存储库文件,基本上提供干净的导出,但以智能的方式完成?
Windows 是首选,但我想 Cygwin 是一个选择。
I basically want to do an SVN export as part of a scripted build process, but without having to get the entire repo from scratch every time, which is slow and eats bandwidth... not to mention will make testing the script a pain in the backside if it does this everytime we tweak something or spot a typo in the scripts.
Is there an obvious way to do an export into an existing directory, so only files that are different are fetched, and non-repo files are deleted, basically giving a clean export but done in a smart way?
Windows is preferred, but I guess Cygwin is an option.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我认为完成此任务的唯一方法是签出工作副本,然后更新和更新。恢复那个。更新 WC 仅获取更改。
svn export 不知道哪些文件被更改,并且要比较文件,您首先必须获取所有文件。此外,很难从“导出”目录中获取已删除或重命名的文件。
I think the only way to get this done, is to checkout a working copy, and update & revert that. Updating a WC only gets the changes.
svn export doesn't know what files are changed, and to compare files, you first have to fetch all of them. Also it would be hard to get files that were deleted or renamed out of your 'export' directory.
签出工作副本,然后从工作副本中导出。
工作副本上的 SVN 更新将变得快速且轻松。
然后您可以删除原始导出并从工作副本中重新导出。
所有需要带宽的操作都经过优化。严厉的删除和重新创建与以前相同,但现在都是本地的,所以应该快得多。
此外,您可以选择在导出的工作副本中进行更改,但您可能需要小心并考虑 svn 更新期间发生冲突的影响。
Checkout a working copy, then export from your working copy.
SVN update on the working copy will then be quick and bandwitch light.
Then you can delete the original export and re-export from the working copy.
All the bandwidth hungry operations are optimized. The heavy handed delete and re-create is the same as it was before, but it's now all local, so should be much faster.
Also, you have the option to make changes in the exported working copy, but you might want to be careful with that and consider the impact of having conflicts occur during your svn update.
我不确定我是否理解你的问题。重新表述一下。我认为您希望定期更新存储库本地副本。但是,您希望工作副本保持原始状态,以便生成的构建是干净的。考虑到这是你的问题,我的建议如下。
据我所知 svn export 可能不是最好的选择。因为 svn export 的目的是获取 svn repo 的未版本化工作副本。由于它没有版本控制,svn 客户端不会真正知道从哪里开始更新。
我能想到的最好的选择是这个。在某个位置检出存储库的副本(本地副本,LC)。该 LC 应在构建过程中更新。在不同位置制作 LC 的副本并使用它来执行构建。下面是您需要的
一些命令,用于消除构建过程时间中的复制时间
如果您想在构建过程中节省复制时间,您可以在每次构建和 svn 更新后执行此复制操作构建之前的副本(假设保留 .svn 文件夹)。
在 Linux 上,两个文件夹可以使用 rsync 保持同步。可以制作构建副本以反映原始副本中的更新。
在 Windows 中,有一些工具可以实现上面建议的同步。我还没有使用过它们,但我会为您提供链接来亲自尝试。
http://lifehacker.com/326199/synchronize-folders-with-synctoy-20
http://www.techsupportalert.com/best-free-folder-synchronization-utility.htm
I am not sure if I understand your question right. To rephrase it. I think you would want to have the repo local copy updated on a regular basis. However you would want the working copy pristine so that the resulting build is a clean. Considering this is your question below is what I would suggest.
To my knowledge svn export might not be the be best option for this. Because the purpose of svn export is to obtain a unversioned working copy of the svn repo. As it is unversioned, svn client would not really know from where it has to start the update.
The best option i can think of is this. Checkout the copy of the repo (local copy, LC) in a location. This LC should be updated during the build process. Make a copy of the LC in a different location and use it for performing the build. Below are the commands you would require
Some Options for Eliminating the copy time from factoring in the build process time
If you would like to save the copy time during the build process probably you can do this copy operation after each build and svn update the copy just before building (assume the .svn folders are retained).
On linux two folders can be kept in sync using rsync. The build copy can be made to reflect the updates in the pristine copy.
In Windows, there are a few tools to achieve sync suggested above. I have not used them but I will provide you the links to try it yourself.
http://lifehacker.com/326199/synchronize-folders-with-synctoy-20
http://www.techsupportalert.com/best-free-folder-synchronization-utility.htm
另一种选择是使用签出和恢复/更新,但也使用 SharpSvn 库之类的东西来制作一个删除非源代码控制文件的脚本。这样,编译代码等构建工件将被删除,并且版本化文件将通过恢复/更新返回到基本状态。
如果您有很多目录和文件,则此扫描可能会很慢,但如果您对哪些目录将包含构建工件有信心,则可以只扫描这些目录和文件。
Another option is to use checkout and revert / update but also use something like the SharpSvn library to make a script that will delete non-source controlled files. This way build artifacts like compiled code will be removed and the versioned files will be returned to base state by the revert / update.
If you have a lot of directories and files this scanning could be slow, but if you are confident about what directories will contain build artifacts would can just scan those.