Linux SVN Server
SVN Server在每个仓库中的hooks里都有个pre-commit.tmpl文件,修改这个文件为pre-commit并添加可执行权限:chmod +x pre-commit。pre-commit文件内容如下:
REPOS=”$1″
TXN=”$2″# Make sure that the log message contains some text.
SVNLOOK=/usr/bin/svnlook
LOGMSG=`$SVNLOOK log -t “$TXN” “$REPOS” | grep “[a-zA-Z0-9]” | wc -c`if [ "$LOGMSG" -lt 10 ]; then
echo -e “Please provide a meaningful comment when committing changes.” 1>&2
exit 1
fi# All checks passed, so allow the commit.
exit 0
Windows SVN Server
同样在每个仓库的hooks目录下有个pre-commit.tmpl,修改为pre-commit.bat
@echo off
::
:: Stops commits that have empty log messages.
::
@echo off
set svnlook="E:\csvn\bin\svnlook.exe"
setlocal
rem Subversion sends through the path to the repository and transaction id
set REPOS=%1
set TXN=%2
rem check for an empty log message
%svnlook% log %REPOS% -t %TXN% | findstr . > nul
if %errorlevel% gtr 0 (goto err) else exit 0
:err
echo. 1>&2
echo Log Message不能为空, 请填写JIRA系统相应的Key+主题! 例如: XDYY-1 系统性能测试 1>&2
exit 1