在Windows下配置svn服务端钩子程序

需求一,svn提交时必须填写log日志的需求

@echo off
::
:: Stops commits that have empty log messages.
::

@echo off

set svnlook="C:\Program Files\VisualSVN Server\bin\svnlook.exe" #根据实际情况而定
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信息(需大于10个字符),然后再重新提交! 1>&2
exit 1

需求二:提交svn后,需要同步web目录

@echo off
SET REPOS=%1
SET REV=%2
SET DIR=%REPOS%/hooks
SET PATH=%PATH%;
SET WORKING_COPY=E:\phpStudy\PHPTutorial\WWW\zhonghuan #已经checkout出的web路径
svn update %WORKING_COPY% --username test --password 123 #帐号和密码

 

posted @ 2018-10-15 10:33  哈喽哈喽111111  阅读(408)  评论(0编辑  收藏  举报