I have set up my subversion/trac environment on Windows (Now Win7, previously tried on Vista) and all works perfectly. But I can't get my post-commit to work. Here's the setup (using VisualSVN and Trac running on Apache):
C:\Users\Martin\Repositories\test_svn\hooks:
post-commit.bat:
call %~dp0\trac-post-commit-hook.cmd %1 %2
trac-post-commit-hook.cmd:
@ECHO OFF
::
:: Trac post-commit-hook script for Windows
::
:: Contributed by markus, modified by cboos.
:: Usage:
::
:: 1) Insert the following line in your post-commit.bat script
::
:: call %~dp0\trac-post-commit-hook.cmd %1 %2
::
:: 2) Check the 'Modify paths' section below, be sure to set at least TRAC_ENV
:: ----------------------------------------------------------
:: Modify paths here:
:: -- this one *must* be set
SET TRAC_ENV=C:\Users\Martin\Trac\test_svn
:: -- set if Python is not in the system path
SET PYTHON_PATH=
:: -- set to the folder containing trac/ if installed in a non-standard location
SET TRAC_PATH=
:: ----------------------------------------------------------
:: Do not execute hook if trac environment does not exist
IF NOT EXIST %TRAC_ENV% GOTO :EOF
set PATH=%PYTHON_PATH%;%PATH%
set PYTHONPATH=%TRAC_PATH%;%PYTHONPATH%
SET REV=%2
Python "%~dp0\trac-post-commit-hook" -p "%TRAC_ENV%" -r "%REV%"
trac-post-commit-hook:
Grabbed from http://trac.edgewall.org/browser/branches/0.11-stable/contrib/trac-post-commit-hook
I have tested the scripts in a cmd window and they work all the way. But on a TortoiseSVN commit, nothing happens, which makes me believe that Tortoise never runs the post-commit.bat.
开发者_StackOverflow社区I have also tested a simple pre-commit, and that works. The strange thing is that is HAS worked before, but I think I used an earlier release of VisualSVN then.
Does anyone have any idea on what's going on here?
Thanks a lot! /Martin
The post-commit hook is run server side. If the hook is implemented correctly, it should work for any Subversion client. You'll want to take a look at this chapter from the SVN book.
Follow-up: You might take a look at this blog entry.
精彩评论