在源代码中包含SVN修订号 [英] Include SVN revision number in source code
问题描述
我的要求很简单。在每个文件的开头应该有这样的块注释:
My requirement is simple. At the beginning of each file there should be a block comment like this:
/*
* This file was last modified by {username} at {date} and has revision number {revisionnumber}
*/
我想填充 {username}
, {date}
和 {revisionnumber}
使用 SVN
中的相应内容。
I want to populate the {username}
, {date}
and {revisionnumber}
with the appropriate content from SVN
.
如何使用<$ c实现此目的$ c> NetBeans 和 Subversion
?我搜索了很多,但我找不到我需要的东西。
How can I achieve this with NetBeans
and Subversion
? I have searched a lot but I can't find exactly what I need.
推荐答案
我看了这个问题,并获得了一些有用的信息。它并不完全重复,因为我正在使用 NetBeans
,但这个想法是一样的。这是我的标题:
I looked at this question and got some useful information. It is not exactly duplicate because I am working with NetBeans
but the idea is the same. This is my header:
/*
* $LastChangedDate$
* $LastChangedRevision$
*/
然后我转到团队> Subversion> Svn属性并且将 svn:keywords
添加为属性名称,将 LastChangedDate LastChangedRevision
添加为属性值。
Then I go to Team > Subversion > Svn properties and add svn:keywords
as property name and LastChangedDate LastChangedRevision
as property value.
当我从 NetBeans
提交时,它看起来像这样:
And when I commit from NetBeans
it looks like this:
/*
* $LastChangedDate: 2012-02-13 17:38:57 +0200 (Пн, 13 II 2012) $
* $LastChangedRevision: 27 $
*/
感谢大家的支持!我会接受我的回答,因为其他答案不包括 NetBeans
信息。不过我将 +1
提供给其他答案。
Thanks all for the support! I will accept my answer because other answers do not include the NetBeans
information. Nevertheless I give +1
to the other answers.
这篇关于在源代码中包含SVN修订号的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!