自己在Windows上用VisualSVN搭了个服务器,默认提交代码是可以不填任何信息,这可不是我所期望的,于是找到了下面的解决方案:
在VisualSVN的管理控制台中可以设置这些规则,这些规则在特定的时机触发,其中Commit代码之前检查是否填写了log信息,我们可以在pre-commit时进行。
设置方法:
1、打开VisualSVN管理控制台
2、右键你要设置的代码仓库
3、所有任务-》Manage Hooks……
4、编辑“Pre-commit hook"
添加如下代码:
@echo off
::
:: Stops commits that have empty log messages.
::
@echo off
set svnlook="D:/Program Files/VisualSVN Server/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 Your commit has been blocked because you didn't give any log message 1>&2
echo Please write a log message describing the purpose of your changes and 1>&2
echo then try committing again. -- Thank you 1>&2
exit 1
CentOS 6.2 SVN搭建 (YUM安装)
Windows下SVN服务器搭建和使用 + 客户端重新设置密码