将 svn checkout 更新到特定日期(包括外部)
我想对特定日期执行 svn 更新,可以使用 svn update -r {2010-10-17}
来执行此操作。不幸的是,当遇到外部时,它将在外部中进行更新,而不通过 -r {2010-10-17}
选项。这导致我们获得了基本代码的正确过去版本,但许多外部代码的最新(不需要的)版本。
如何更新到特定修订版或日期并通过外部正确递归?
(注意:我知道这里的错误可能是使用了没有指定明确修订的外部组件。)
I want to perform an svn update to a specific date, and I can do this with svn update -r {2010-10-17}
. Unfortunately when this encounters an external it will do the update within the external without passing through the -r {2010-10-17}
option. This results in us getting the correct past revision of the base code, but the latest (undesired) versions of many of the externals.
How can I update to a specific revision or date and have this recurse correctly through the externals?
(Note: I understand that the mistake here might have been to use externals with no explicit revisions specified.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
我希望,任何人迟早都会将我的常识性逻辑(仅限于某些领域的目录类型外部)实现到 bash 和 cmd 脚本中,我们将对此重复得到“明确的答案” 你的基本任务
是:
svn up
你的超级仓库到过去所需的点(更新到日期/并且没有时间/是,顺便说一句,不是最好的选择,但是 - 适用)svn propget svn:externals -R
(-R 是为了检查整个树,而无需大量 < code>cd). - https://subversion.assembla.com/svn/subversion-trouble-shooting/trunk/lib lib
): cd 到字符串的最后一个字段 / 相对于第一个字段,这又是 root/ 的相对路径,并且 svn 直到同一点,就像对 superrepo 所做的那样: svn update -r {2010-10-17}因此,您将拥有混合工作副本,但超级存储库和外部文件将处于“过去的某些修订”状态。
注意:
用于使用外部文件构建目录的本地路径的附加示例(嵌套 WC 确实)在更复杂的情况下。
对于
我的 WC 中外部的最终路径将是(相对于 WC-root)
I hope, anybody will implement my common-sense logic (limited to directory-type externals in some areas) into bash and cmd-script sooner or later and we'll get "definitive answer" to this repeating question
Your base task is:
svn up
your super-repo to needed point in past (updating to date /and without time/ is, BTW, not a best choice, but - apllicable)svn propget svn:externals -R
(-R in order to check the whole tree without a lot ofcd
). - https://subversion.assembla.com/svn/subversion-trouble-shooting/trunk/lib lib
): cd to the last field of string /relative to the first field, which is, in turn, is relative path to root/ and svn up to the same point, as it was done for superrepo:svn update -r {2010-10-17}
As result you'll have Mixed Working Copy, but superrepo and externals will be in state "for some revision in the past"
Note:
Additional sample for constructing local path to directory with externals (nested WC really) on more complex case.
For
finals paths to externals in my WC will be (relative to WC-root)
我添加这个答案是为了防止有人试图更新已签出的 subversion 存储库以将本地文件日期同步到存储库日期,我想这样做,这样我就可以进行 FS 时间戳比较。
我制作了这个 oneliner 来解决这个问题(但在使用它之前请阅读下面的行):
svn info --show-item last-changed-date -R | xargs -I{} -P1000 -n1 sh -c 'x="{}";设置-x; exec touch -d "${x%% *}" "${x#* }"'
注意:
-P1000
指定xargs
应同时运行 1000 个sh
和touch
副本来进行实际更新。根据系统负载,降低此值可能是明智的。在基于 i3 的微型英特尔 NUC 1000 进程上,事实证明它是完美的,使用 80-95% 的 CPU(100% 通常意味着 CPU 过载)。如果有疑问,请打开例如htop
并使用不同的值进行测试 - 但仅运行几秒钟,因为它每次都需要从头开始运行。对于 USB HDD 上大约 3GB 的小型 SVN 存储库,运行大约需要 5 分钟。
set +x
打开详细执行,我在执行touch
之前执行此操作,以便您可以观看它的运行。如果您想要非详细执行,请删除该命令。I'm adding this answer in case anyone's trying to update an already-checked-out subversion repository to sync the local file dates to the repo dates, which I wanted to do so I could do FS timestamp comparisons.
I made this oneliner to do the trick (but read the line below before using it):
svn info --show-item last-changed-date -R | xargs -I{} -P1000 -n1 sh -c 'x="{}"; set -x; exec touch -d "${x%% *}" "${x#* }"'
NOTE: The
-P1000
specifies thatxargs
should run 1000 simultaneous copies ofsh
andtouch
to do the actual updating. Depending on system load it may be wise to lower this. On a tiny i3-based Intel NUC 1000 processes actually turned out to be perfect, using 80-95% CPU (100% generally means the CPU is overloaded). If in doubt, open eghtop
and test with different values - but only run it for a few seconds, because it will need to run from the start each time.For a small ~3GB SVN repo on a USB HDD, this took about 5 minutes to run.
The
set +x
turns on verbose execution, which I do just before executingtouch
so you can watch it run. If you want non-verbose execution, remove that command.我们仅包含其他项目中的整个目录:
具有此布局
svn propget svn:externals -R
返回,您可以更新到修复日期,如下所示:
We include only whole dirs in other projects:
with this layout
svn propget svn:externals -R
returnsand you can update to a fix date as follows:
据我所知,如果不更改外部配置,就无法做到这一点。但是,更改外部配置会为每个人更改它,因此只需一次提交和更新即可完成。
As far as I've been able to work out, you can't do this without changing your externals config. But, changing the externals config changes it for everyone, so it's just a single commit and update and you're done.