SVN提交内容时必须填写日志(输入字符)

来源:互联网 发布:异星工厂 mac 0.14 编辑:程序博客网 时间:2024/05/16 00:49

自己在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 offset svnlook="D:/Program Files/VisualSVN Server/bin/svnlook.exe"setlocalrem Subversion sends through the path to the repository and transaction idset REPOS=%1set TXN=%2rem check for an empty log message%svnlook% log %REPOS% -t %TXN% | findstr . > nulif %errorlevel% gtr 0 (goto err) else exit 0:errecho. 1>&2echo Your commit has been blocked because you didn't give any log message 1>&2echo Please write a log message describing the purpose of your changes and 1>&2echo then try committing again. -- Thank you 1>&2exit 1




0 0
原创粉丝点击