Subversion and Mantis Integration on Windows

We’re running Subversion (via Apache) and Mantis on Windows. I wanted to allow developers to resolve issues via commit comment. I read this great page about it, and used it as a starting point for Windows integration.

After making Mantis configuration changes as specified in that page, I threw together a SVN post-commit hook that I named post-commit.cmd. It looks like this:

@echo off
setlocal enableextensions

set SVN_PATH="c:Program Filessvn-win32-1.6.1bin"
set REPOS=%1
set REV=%2
set TEMPFILE=c:temp%REV%.txt

set MANTIS_PATH="c:Program FilesApache Software FoundationApache2.2htdocsmantis"

cd %MANTIS_PATH%scripts

%SVN_PATH%svnlook log -r %REV% %REPOS% > %TEMPFILE%

php checkin.php < %TEMPFILE% > c:post_commit.log

Obviously, update the paths to Subversion and Mantis.

Now, when somebody puts “issue #56″ in a commit comment, a note gets added to the bug in Mantis. When a developer adds “fixes issue #56″ in a commit comment, the issue also gets set to “resolved.”

Leave a Reply