Question

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 the 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.

Was it helpful?

Solution

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

OTHER TIPS

  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)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top