在svn服务端通过hooks在提交时强制要求写日志。
1. 在hooks目录里,复制文件pre-commit.tmpl到pre-commit
2. 修改pre-commit文件,如下。
#!/bin/sh
REPOS=
"$1"
TXN=
"$2"
SVNLOOK=
/usr/bin/svnlook
#根据你的SVN目录而定
LOGMSG=`$SVNLOOK log -t
"$TXN"
"$REPOS"
|
grep
"[a-zA-Z0-9]"
|
wc
-c`
if
[
"$LOGMSG"
-lt 10 ];
then
echo
"Log message can‘t be empty! you must input more than 10 chars as comment!."
1>&2
exit
1
fi
把上面代码保存为pre-commit,并设置权限为755,将此文件放置在SVN下库的hooks目录下,如:/svn/test/hooks
时间: 2024-11-05 21:47:44