将项目头修订号插入项目文件

Inserting project head revision number into the project files

我在 SVN 版本控制下的 Eclipse 中有一个项目。

假设项目由两个文件A和B组成,我将项目的修订号定义为A和B之间的最新修订版。因此如果A有rev 10和B rev 11则项目的修订版为11 .

如何将项目修订号放入项目文件中?

如果我没记错的话,SVN 关键字扩展是不够的,因为它将最后一次更改的修订号写入每个文件而不是 "project"

没有特定的 svn 关键字或 svn 命令来自动在每个文件中添加 HEAD 修订版。但是有一个 svn 命令可以检索这个修订号。然后你必须自己开发额外的工具。
这是 http://svnbook.red-bean.com/en/1.8/svn.advanced.props.special.keywords.html 的摘录:

Where's $GlobalRev$?

New users are often confused by how the $Rev$ keyword works. Since the repository has a single, globally increasing revision number, many people assume that it is this number that is reflected by the $Rev$ keyword's value. But $Rev$ expands to show the last revision in which the file changed, not the last revision to which it was updated. Understanding this clears the confusion, but frustration often remains—without the support of a Subversion keyword to do so, how can you automatically get the global revision number into your files?

To do this, you need external processing. Subversion ships with a tool called svnversion, which was designed for just this purpose. It crawls your working copy and generates as output the revision(s) it finds. You can use this program, plus some additional tooling, to embed that revision information into your files. For more information on svnversion, see the section called “svnversion—Subversion Working Copy Version Info” in Chapter 9, Subversion Complete Reference.