开发者

Adding reviewer name automatically to the source files in subversion

I'm not an expert in subversion, and would appreciate very much for any hints on the following problem.

I want to add a review name automatically into a commented section in th开发者_运维技巧e header of the Java file (.java extension only). This can be done manually, but in case of large commits if would take ages to modify the header for hundreds of files. svn pre-commit hook, or other svn capability might be used here I guess.


Take a look at the documentation on subversion keywords. The Author keyword is the one that may solve your problem.

From the linked document:

For example, say you have a document in which you have some section of tabular data reflecting the document's Subversion keywords. Using the original Subversion keyword substitution syntax, your file might look something like:

 $Rev$:     Revision of last commit
 $Author$:  Author of last commit
 $Date$:    Date of last commit

Now, that looks nice and tabular at the start of things. But when you then commit that file (with keyword substitution enabled, of course), you see:

 $Rev: 12 $:     Revision of last commit
 $Author: harry $:  Author of last commit
 $Date: 2006-03-15 02:33:03 -0500 (Wed, 15 Mar 2006) $:   Date of last commit


  1. You can't change content of transaction in pre-commit hook
  2. You can (for the cost of overall commit-time and additional revision in history) modify needed files in post-commit hook, if you can write code, which perform this modification automatically (Reviewer value have to be stored as some path-property by hand before user's commit)
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜