所以我在设置这个时遇到了一些问题。让我解释。
我的 d:\svn\hooks 文件中有三个文件(D:\ 不是 Windows 驱动器)
post-commit.bat
trac-post-commit-hook.cmd
trac-post-commit-hook
我已经在 d:\svn\hooks 文件中设置了 post-commit.bat 文件,其中包含以下内容
%~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=D:\trac\project
:: -- set if Python is not in the system path
SET PYTHON_PATH=D:\trac\Python25
:: -- set to the folder containing trac/ if installed in a non-standard location
SET TRAC_PATH=D:\trac\Python25\Lib\site-packages\trac
:: ----------------------------------------------------------
:: 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 文件中 - 它只是来自http://trac.edgewall.org/browser/trunk/contrib/trac-post-commit-hook?rev=920的标准脚本
== 问题 ==
当我在 cmd 提示符下运行 post-commit.bat 时 - 它工作正常 - 不会产生错误。
但是,当我在 SVN 中为我在 Trac 中创建的测试票提交某些内容时 - #1 已修复。- Trac 上没有任何变化。根本没有更新。
当我将 'trac-post-commit-hook' 更改为 'trac-post-commit-hook.py' 并从 d:\svn\hooks\python trac-post-commit-hook.py 运行时,我得到
File "trac-post-commit-hook.py", line 104, in <module>
os.environ{'PYTHON_EGG_CACHE'] = os.path.join(options.project, '.egg-cache')
File "D:\trac\Python25\lib\ntpath.py", line 90, in join
assert len(path) > 0
TypeError: object of type 'NoneType' has no len()
我不知道到底出了什么问题?任何人都可以提供任何帮助吗?