VisualSVN服务器不触发提交后挂钩

我有一个令我疯狂的问题。 我想将VisualSVN服务器与Mantis BT集成,所以当我从svn客户端提交时,我发表了类似“fixed issue#3”的评论,那么Mantis中的问题就被标记为已解决。

我遵循http://arklad.wordpress.com/2010/01/07/communicating-mantis-and-subversion-on-windows/中的步骤

所以我创build了一个名为'svn'的开发者angular色的用户,并分配给我的项目。 我编辑了我的螳螂config.inc ,看起来像这样:

 <?php $g_hostname = 'databaseserver'; $g_db_type = 'mssqlnative'; $g_database_name = 'mantisbt'; $g_db_username = 'mantis'; $g_db_password = 'mypass'; $g_allow_file_upload = ON; $g_file_upload_method = DISK; # User account that connects with Subversion $g_source_control_account = 'svn'; # Regular expression to be matched in the comments # Example: issue #1 $g_source_control_regexp = '/\b(?:bug|issue|error)\s*[#]{0,1}(\d+)\b/i'; # Regular expression to be matched to fix an issue # Example: fixed issue #1 $g_source_control_fixed_regexp = '/\b(?:fixed|fixes|resolved)\s+(?:bug|issue|error)?\s*[#](\d+)\b/i'; # Status after solving the issue $g_source_control_set_status_to = RESOLVED; # Resolution after solving the issue $g_source_control_set_resolution_to = FIXED; ?> 

然后,我创buildpost-commit.bat文件并将其放在hooks文件夹中:

 @ECHO on SET REPOS=%1 SET REV=%2 SET PHP="C:\Program Files (x86)\PHP\v5.3\php.exe" SET CHECKIN="C:\WebSites\mantisbt-1.2.14\scripts\checkin.php" SET SVNLOOK="C:\Program Files (x86)\VisualSVN Server\bin\svnlook.exe" SET LOGFILE=C:\log.txt SET AUTHORFILE=C:\author.txt SET OUTPUTFILE=C:\output.txt %SVNLOOK% log -r %REV% %REPOS% > %LOGFILE% %SVNLOOK% author -r %REV% %REPOS% > %AUTHORFILE% TYPE %LOGFILE% > %OUTPUTFILE% %PHP% %CHECKIN% < %OUTPUTFILE% >> %LOGFILE% ECHO "Post-commit for revision %REV% finished" >> %LOGFILE% @ECHO off 

所有的path都是正确的(检查多次),当我分别运行(它创build输出文件) .bat执行良好。

我得出的结论是,VisualSVN不会触发post-commit.bat 。 我也重启了很多次服务器。 我究竟做错了什么?

仔细检查VisualSVN Server服务帐户(默认情况下是Network Service帐户)是否具有对提交后脚本尝试触摸或操作的所有文件和文件夹的访问权限。

我认为这些地方“无法进入”是根本原因:

  • C:\Program Files (x86)\PHP\v5.3\和它的孩子,
  • C:\WebSites\mantisbt-1.2.14\scripts\ ,它是孩子。

挂钩脚本不能工作有多种原因。 您应该排查钩子并获取错误输出以了解原因。 错误输出有助于了解根本原因并解决问题。

为了将输出捕获到日志文件中,您可以执行以下操作:

  1. 将当前的post-commit.bat文件重命名为post-commit-run.bat

  2. 创build以下文件作为您的post-commit.bat文件:

    call "%~dp0post-commit-run.bat" %* > %1/hooks/post-commit.log 2>&1

  3. 提交到存储库并检查生成的日志文件。