在项目库的hooks目录下,添加一个pre-commit.bat文件
内容如下(注意其中的SVN_BINDIR路径,可能需要改一下)
@echo off
rem SVN强制写注释的hooks脚本(Windows)
rem 文件名是: pre-commit.bat,放到repository/hooks目录下
setlocal
set SVN_BINDIR="C:\Program Files\CollabNet\Subversion Server"
set REPOS=%1
set TXN=%2
rem check that logmessage contains at least 10 characters
%SVN_BINDIR%\svnlook log "%REPOS%" -t "%TXN%" | findstr "......" > nul
if %errorlevel% gtr 0 goto err
exit 0
:err
echo 提交时必须填写注释(Message)! 1>&2
echo "%REPOS%" -t "%TXN%" 1>&2
exit 1