@echo
rem 文件名是: pre-commit.bat,放到repository/hooks目录下
setlocal
set SVN_BINDIR="D:\Program Files\VisualSVN Server\bin"
set REPOS=%1
set TXN=%2
rem 检查是否提交日志
%SVN_BINDIR%\svnlook log -t "%TXN%" "%REPOS%" | findstr "..............." >nul
if %errorlevel% gtr 0 goto nolog
:nolog
echo Log (Message) is an important information, tracking document must be input, not the input meaningless characters, length shall not be less than 15 characters! >&2
exit 1
需求:今天根据项目经理的要求,要求开发人员在使用SVN进行提交的时候一定要填写SVN的日志信息,否则不允许开发人员提交信息!实现方式: 把下面的代码保存为pre-commit,并设置权限为755,将此文件放置在SVN下的hooks目录下,如:/work/svn/test/hooks01#!/bin/sh02REPOS="$1"03TXN="$2"04 05SVNLOOK=/usr/local/subversion/bin/svnlook #根据你的SVN目录而定06 07LOGMSG=`$SVNLOOKlog -t"$TXN""$REPOS"| grep"[a-zA-Z0-9]"| wc -c`08if["$LOGMSG"-lt 10 ]09then10 echo"Log message can't be empty! you must input more than 10 chars as comment!."1>&211 exit112fi欢迎分享,转载请注明来源:内存溢出
评论列表(0条)