Force comments on each commit in Subversion
When using version control it is important the comments are specified for each commit. This will help you and your colleagues a lot when trying to find out why what happened in the past. A lot of people tend to forget to fill in the comment when committing their changes. In Subversion comments for each commit can be forced by having the pre-commit hook on the repository. When you have this pre-commit hook the changes simply won’t be committed if no comment is specified.
Next is a sample for a pre-commit hook on a Windows Subversion server.
SET REPOSITORY=%1% SET TRANSACTION=%2% SET ERROR=1 SET SUCCESS=0 REM check if the commit does not have any comments svnlook log %REPOSITORY% -t %TRANSACTION% | findstr . > nul IF %errorlevel% gtr 0 (GOTO NoCommentError) EXIT %SUCCESS% :NoCommentError ECHO. 1>&2 ECHO Error: 1>&2 ECHO There is no comment specified for this commit. 1>&2 ECHO You must write a comment describing your changes. 1>&2 EXIT %ERROR%