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

On 20 nov, 14:24, "Emmanuel Blot" <[EMAIL PROTECTED]> wrote:
> > Thanks Manu, I will try that. But can't believe that trac hooks are
> > not used for windows based installations... However, I haven't found
> > anything about p*-commit.bat pure batch launchers. If anybody knows...
> > Thanks again Manu !
>
> Actually, there are some successful windows installations of pure .bat
> callers for Trac hook scripts; but also many issues with quotes,
> white-space character in path and so forth ;-)
> Note that the .sh wrappers I use don't call svnlook and friends:
> everything is done in the Python script, so you may want to use the
> original trac hook scripts.
>
> Cheers,
> Manu
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to