简体   繁体   English

通过头部修订在任何操作上更新一个特定文件

[英]Update one specific file on any action with head revision

i want to have on file, that contains the HEAD revision of the whole project. 我要存档,其中包含整个项目的HEAD版本。

i know, that i can do that with svn propset . 我知道,我可以使用svn propset来做到这一点。 but the problem of this is, if the file is not changed, the value of the revision will, indeed, stay the same. 但是这样做的问题是,如果不更改文件,则修订的值实际上将保持不变。

how can i achieve that this file is always updated with the HEAD revision. 我怎么能实现这个文件总是用HEAD版本更新。 no matter which file was modified. 无论修改哪个文件。

is that even possible to achieve? 那有可能实现吗?

You can't do this inside svn repository (unless you change this specific file on each commit, not very desirable). 您不能在svn存储库中执行此操作(除非您每次提交都更改此特定文件,这不是很理想)。

However there is a small tool called svnversion (part of subversion commandline). 但是,有一个名为svnversion的小工具(subversion命令行的一部分)。 By calling this inside your workingcopy (or pointing to it via argument) it returns the revision number of this specific workingcopy. 通过在您的工作副本中调用此文件(或通过参数指向它),它将返回此特定工作副本的修订版号。

I suggest you call this tool after each update and write the result into a (svn ignored) textfile inside your workingcopy. 建议您在每次更新后调用此工具,并将结果写入工作副本内的(忽略svn)文本文件中。

TortoiseSVN has client-side hookscripts (Post-Update-Hook) which can further automate this for you. TortoiseSVN具有客户端钩子脚本(Post-Update-Hook),可以进一步为您自动化。

Keep in mind that svnversion returns more than just a single number, if you have sparse checkout, modified or switched working copies 请记住,如果结帐稀少,修改或切换了工作副本,则svnversion返回的不只是一个数字

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM