首页 > 技术文章 > 设置SVN提交日志必填

hornet 2015-01-03 08:39 原文

1.打开visualSVN Server
2.打开Repositories
3.右键需要控制的项目->所有任务->manage hooks...
4.选择Hooks tab,点击Pre-commit hook进入编辑界面
5.将以下的内容复制到输入框中

@echo off  
::      
:: Stops commits that have empty log messages.  
::  
@echo off  
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或者Log字数过少(必须大于10),系统拒绝提交! 1>&2  
echo Log格式: 新增/修改/删除: 提交内容 1>&2  
echo 请详细描述提交内容,然后再提交. -- 谢谢! 1>&2  
exit 1

推荐阅读