在源代码中包含 SVN 修订号 [英] Include SVN revision number in source code

查看:30
本文介绍了在源代码中包含 SVN 修订号的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的要求很简单.在每个文件的开头应该有一个像这样的块注释:

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}
 */

我想用SVN<的适当内容填充{username}{date}{revisionnumber}/代码>.

如何使用 NetBeansSubversion 实现这一点?我已经搜索了很多,但我找不到我需要的东西.

How can I achieve this with NetBeans and Subversion? I have searched a lot but I can't find exactly what I need.

推荐答案

我看了this 问题并获得了一些有用的信息.它并不完全重复,因为我正在使用 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$
 */

然后我转到 Team > Subversion > Svn properties 并添加 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆