上层: verifymsg
下面是一些 verifymsg 文件,以及相应的 rcsinfo 文件, 日志消息模板和校验脚本的蠢笨实例。我们以日志消息开始模板。我们想要在日志消息的 第一行中总是记录 bug-id 号。剩余的日志消息是任意文字。下面的模板可以在 /usr/cvssupport/tc.template 文件里面找到。
BugId:
脚本 /usr/cvssupport/bugid.verify 用来评估日志消息。
#!/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
verifymsg 文件包含:
^tc /usr/cvssupport/bugid.verify %l
rcsinfo 文件包含:
^tc /usr/cvssupport/tc.template
config 文件包含:
RereadLogAfterVerify=always