是否有“修改计数”的 svn:keyword? Subversion 中版本化文件的

发布于 2024-08-12 07:47:21 字数 423 浏览 5 评论 0原文

CVS 中的 $Revision$ 显示文件的版本,它基于修改计数。

这非常方便,因为修改计数可以用作“构建编号”,对于每个文件,数字本身反映了文件的“成长寿命”。

但在SVN中,版本是关于整个存储库的,对文件的任何修改都是对整个存储库的“原子操作”,所以如果存储库版本是342912,并且创建了一个新文件,那么该文件有一个开始修订号为342912,而不是更直观的1。

您始终可以通过以下方式获取修改计数,

FILE_BUILD_NUMBER = `svn log -q FILE | grep r | wc -l`

但这效率不高,而且相当耗时。只需在存储库中添加一个修改计数字段,并在每次提交文件时递增,就可以很容易地在 subversion 中实现。那么,这个功能已经实现了吗?是否有 svn: 关键字来扩展它?

The $Revision$ in CVS shows the version of a file, which based on modification count.

This is very convienient, as the modification count can be used as "Build Number", and for each file, the number itself reflects the "growing life" of a file.

But in SVN, the version is about the whole repository, any modification to files are by means of "atom operation" to the whole repository, so if the repository version is 342912, and a new file is created, then that file has a start revision number of 342912, not 1 which is more intuitive.

You can always get the modification count by

FILE_BUILD_NUMBER = `svn log -q FILE | grep r | wc -l`

But this is not efficient and it's rather time cosuming. It should be easy to implement in the subversion by just add an modified-count field in the repository, and increment each time a file is commited. So, is this feature already implemented? Is there a svn:keyword to expand that?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

假扮的天使 2024-08-19 07:47:21

简短的回答:不。

The short answer: No.

久光 2024-08-19 07:47:21

不,这破坏了 SVN 存储库级别修订的想法。实际上,Subversion 的修订号更有帮助,因为它为您提供了一个数字来标识整个存储库的状态,而不仅仅是该文件的状态。您只需要接受以下事实:(1) 转速数并不总是会增加 1,并且 (2) 转速数不会从 1 开始。

(将 SVN 转速数视为“时间戳”会有所帮助。)

No, this undermines the idea of SVN repository-level revisions. Actually, the revision number from Subversion is more helpful, because it gives you a number to identify the state of the entire repository, not just that file. You just have to accept that (1) rev numbers are not always going to increment by 1, and (2) rev numbers will not start at 1.

(It helps to think of the SVN rev number as a "timestamp".)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文