Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
285 views
in Technique[技术] by (71.8m points)

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

I want to populate the {username}, {date} and {revisionnumber} with the appropriate content from SVN.

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

Then I go to Team > Subversion > Svn properties and add svn:keywords as property name and LastChangedDate LastChangedRevision as property value.

And when I commit from NetBeans it looks like this:

/*
 * $LastChangedDate: 2012-02-13 17:38:57 +0200 (Пн, 13 II 2012) $
 * $LastChangedRevision: 27 $
 */

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...