现在的位置: 首页 > 综合 > 正文

windows下强制svn用户写log

2013年09月07日 ⁄ 综合 ⁄ 共 505字 ⁄ 字号 评论关闭

在版本库hooks目录下,添加 pre-commit.bat文件,并添加如下内容

@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 Log message must be longer than 10 characters! 1>&2

exit 1

 

有两点需要注意,一是要把subversion的安装目录中bin目录设置到系统PATH中,否则无法找到 svnlook,当然直接在pre-commit.bat中设置也可以

二是findstr........... 中国点的个数表示log最少长度(英文字符长度),这里限制为11个characters

抱歉!评论已关闭.