分类: 项目管理
2013-06-16 11:31:04
@echo off
setlocal enabledelayedexpansion
set SVNLOOK="C:\Program Files\VisualSVN Server\bin\svnlook"
rem 注释包含:"[故障号]:XXXXXX(6位数)"
set Num=[0-9][0-9][0-9]
set GZH="\[故障号\]:"%Num%%Num%
rem 注释包含:"[修改内容]:"
set XGNR="\[修改内容\]:"
"C:\Program Files\VisualSVN Server\bin\svnlook" log %1 -t %2 | findstr "%GZH%" >nul 2>nul
if !errorlevel! equ 0 ( goto :gzh)
echo "注释必须包含故障号。格式为[故障号]:XXXXXX" >&2
goto :fail
:gzh
"C:\Program Files\VisualSVN Server\bin\svnlook" log %1 -t %2 | findstr "%GZH%[0-9]" >nul 2>nul
if !errorlevel! equ 0 ( goto :errgzh)
goto :xgnr
:errgzh
echo "故障号应该是6位数字,超过了6位,请检查! ">&2
goto :fail
:xgnr
"C:\Program Files\VisualSVN Server\bin\svnlook" log %1 -t %2 | findstr "%XGNR%" >nul 2>nul
if !errorlevel! equ 0 ( goto :success)
echo "注释必须包含修改内容,格式为[修改内容]: " >&2
goto :fail
:fail
exit 1
goto :end
:success
exit 0
:end