cp svn库/hooks/pre-commit.tpml svn库/hooks/pre-commit
vi svn库/hooks/pre-commit.tpml
shell内容:
-----------------------------------
#!/bin/sh
REPOS="$1"
TXN="$2"
# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook #svnlook命令
LOGMSG=`$SVNLOOK log -t "$TXN" "$REPOS" | grep "[a-zA-Z0-9]" | wc -c`
if [ "$LOGMSG" -lt 1 ]; #1个字条
then
echo -e "log is null(notice:Write why)" 1>&2 #提示信息
exit 1
fi
exit 0
原理:
利用svn的hooks运行shell
注意:
作了钩子后,提交速度会慢