SVN Hook to stop commits without comments

As SVN admin we need to make sure any commits made to the repository should have comments associated it with. The reason to have comments during commits is simple to know what has been fixed or what new has been added to the repository. Here is the simple shell script I have written to stop the commits if comments has not been added.


LOGM=`$SVNLOOK log -t "$TXN" "$REPOS"`
AUTHOR=`$SVNLOOK author -t "$TXN" "$REPOS"`
LOGM1=`echo $LOGM | sed 's/ //g'`
LOGM2=`echo $LOGM | wc -w`

if [ "$LOGM1" == "" ]
echo -e "Comment is mandatory" 1>&2
exit 1

if [ $LOGM2 -lt 5 ]
echo -e "Comment should be descriptive." 1>&2
exit 1

exit 0

This script can be extend to make extra checks as well. I hope it will be helpful for someone out there.

You can also write SVN Hook to send email after commit

1 Comment

Leave a Reply

Your email address will not be published.


CommentLuv badge