Sunday 17 May 2009

Forcing comments in Subversion

While administering Subversion is a simple task, getting all developers to add comments to their subversion is not. The importance of having comments while checking-in their code helps especially in an Agile environment where in there may be several check ins during the day and comments are an important tool in communicating what was done. Fortunately for those forgetful developers, there is help at hand to enforce commenting during a check-in.

A simple script available in a dormant form with every Subversion installation works the magic. The operation of the script is explained very clearly in this blog post. The script is present in the pre-commit.tmpl file in the /{repository-location}/hooks/ directory. To get it to fire, make sure the script has commands that are valid DOS commands (if you are in a Windows environment) AND re-name the file to pre-commit.bat. That's it. Every check-in will require a comment!!

No comments: