SVN 送交後自動發信通知相關人員 (win32版)

摘要:SVN 送交後自動發信通知相關人員 (win32版)

 

post-commit.bat

@echo off
REM *************************************************************
REM *參考網址:
REM * http://blog.roodo.com/emisjerry/archives/844150.html
REM * http://blog.pengoworks.com/index.cfm/2008/2/5/SVN-postcommit-for-Windows
REM * http://caspian.dotconf.net/menu/Software/SendEmail/  win32下的 sendmail^^
REM *************************************************************
set REPOS=%1
set REV=%2
set LogFile=%REPOS%\post%REV%.txt
set SMTP_SERVER=192.168.10.99
set EMAIL_TO=user1@xx.com.tw user2@xx.com.tw
set EMAIL_FROM=svnadmin@eri.com.tw
set EMAIL_BCC=rachen@eri.com.tw
set SUBJECT=XXX案庫版本異動通知[%REPOS%]

set APR_ICONV_PATH=C:\Program Files\Subversion\iconv

REM echo %1 %2 >> %LogFile%

echo. > %LogFile%

>>%LogFile% set/p="送交日期:" <nul
SVNLOOK date "%REPOS%" "%REV%"  >> %LogFile%
>>%LogFile% set/p="作者:" <nul
SVNLOOK author "%REPOS%" "%REV%"  >> %LogFile%
>>%LogFile% set/p="目前版本序號:" <nul
SVNLOOK youngest "%REPOS%" "%REV%"  >> %LogFile%
echo. >> %LogFile%

echo ---異動檔案: >> %LogFile%
SVNLOOK changed "%REPOS%" "%REV%" >> %LogFile%
echo. >> %LogFile%

echo ---送交紀錄: >> %LogFile%
SVNLOOK log "%REPOS%" "%REV%"  >> %LogFile%
echo. >> %LogFile%

sendEmail -s %SMTP_SERVER% -t %EMAIL_TO% -bcc %EMAIL_BCC% -f %EMAIL_FROM% -u "%SUBJECT%" -o message-file=%LogFile% message-charset=big5

del %LogFile%