Hi,
I finally made the trac-pre-commit-hook and trac-post-commit-hook
scripts work on my SVN/Apache/Trac Windows install.
Here under, you'll find pre-commit.bat and post-commit.bat, which are
Windows batch-only launchers for python trac-*-commit-hooks :
Hope that will help somebody...
Pierre
pre-commit.bat :
################
@ECHO OFF
rem pre_commit.bat
rem launches trac-pre-commit-hook
rem tested with svn 1.4.5, apache 2.0.61 and trac 0.10.4
SET REPOS=%1
SET REV=%2
rem setup paths
SET SVN_DIR=C:\Program Files\Subversion
SET PYTHON_DIR=C:\Python24
SET HOOKS_DIR=D:\svn_repos\hooks
SET TRAC_ENV=D:\trac\initenv\
SET TRAC_URL=http://localhost/trac/
SET PYTHON="%PYTHON_DIR%\python.exe"
SET SVN="%SVN_DIR%\bin\svn.exe"
SET SVNADMIN="%SVN_DIR%\bin\svnadmin.exe"
SET SVNLOOK="%SVN_DIR%\bin\svnlook.exe"
SET TEMP=C:\temp
SET LOG_FILE=%TEMP%\svnfileT-%REV%-log
rem get log
%SVNLOOK% log -t %REV% %REPOS%>%LOG_FILE%
set /p LOG=<%LOG_FILE%
rem run trac-pre-commit-hook
%PYTHON% %HOOKS_DIR%\trac-pre-commit-hook %TRAC_ENV% "%LOG%"
rem test return code
IF ERRORLEVEL 1 SET TRAC_CANCEL=YES
DEL /F %LOG_FILE%
IF DEFINED TRAC_CANCEL GOTO :ERROR
:SUCCESS
EXIT 0
:ERROR
EXIT 1
post-commit.bat :
#################
@ECHO OFF
rem pre_commit.bat
rem launches trac-post-commit-hook
rem tested with svn 1.4.5, apache 2.0.61 and trac 0.10.4
SET REPOS=%1
SET REV=%2
rem setup paths
SET SVN_DIR=C:\Program Files\Subversion
SET PYTHON_DIR=C:\Python24
SET HOOKS_DIR=D:\svn_repos\hooks
SET TRAC_ENV=D:\trac\initenv\
SET TRAC_URL=http://localhost/trac/
SET PYTHON="%PYTHON_DIR%\python.exe"
SET SVN="%SVN_DIR%\bin\svn.exe"
SET SVNADMIN="%SVN_DIR%\bin\svnadmin.exe"
SET SVNLOOK="%SVN_DIR%\bin\svnlook.exe"
SET TEMP=C:\temp
SET LOG_FILE=%TEMP%\svnfileT-%REV%-log
SET AUTHOR_FILE=%TEMP%\svnfileT-%REV%-author
rem get log
%SVNLOOK% log -t %REV% %REPOS%>%LOG_FILE%
set /p LOG=<%LOG_FILE%
rem get author
%SVNLOOK% author -t %REV% %REPOS%>%AUTHOR_FILE%
set /p AUTHOR=<%AUTHOR_FILE%
rem run trac-post-commit-hook
"%PYTHON%" "%HOOKS_DIR%\trac-post-commit-hook" -p "%TRAC_ENV%" -r %REV%
-u "%AUTHOR%" -m "%LOG%" -s "%TRAC_URL%"
rem test return code
IF ERRORLEVEL 1 SET TRAC_CANCEL=YES
DEL /F %LOG_FILE%
DEL /F %AUTHOR_FILE%
IF DEFINED TRAC_CANCEL GOTO :ERROR
:SUCCESS
EXIT 0
:ERROR
EXIT 1
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org
Received on Tue Nov 20 15:26:33 2007