[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

C.3.5.1 Verifying log messages

The following is a little silly example of a `verifymsg' file, together with the corresponding `rcsinfo' file, the log message template and a verification script. We begin with the log message template. We want to always record a bug-id number on the first line of the log message. The rest of log message is free text. The following template is found in the file `/usr/cvssupport/tc.template'.

 
BugId:

The script `/usr/cvssupport/bugid.verify' is used to evaluate the log message.

 
#!/bin/sh
#
#       bugid.verify filename
#
#  Verify that the log message contains a valid bugid
#  on the first line.
#
if sed 1q < $1 | grep '^BugId:[ ]*[0-9][0-9]*$' > /dev/null; then
    exit 0
elif sed 1q < $1 | grep '^BugId:[ ]*none$' > /dev/null; then
    # It is okay to allow commits with 'BugId: none',
    # but do not put that text into the real log message.
    grep -v '^BugId:[ ]*none$' > $1.rewrite
    mv $1.rewrite $1
    exit 0
else
    echo "No BugId found."
    exit 1
fi

The `verifymsg' file contains this line:

 
^tc     /usr/cvssupport/bugid.verify %l

The `rcsinfo' file contains this line:

 
^tc     /usr/cvssupport/tc.template

The `config' file contains this line:

 
RereadLogAfterVerify=always

This document was generated on September, 14 2007 using texi2html 1.76.