Wednesday, November 29, 2006

Integrating Mantis Bug Tracking with Win32 TortoiseSVN

25-Apr-2005 11:11 #419
Brief guide to TortoiseSVN integration on Win32. This will allow you to enter a Mantis issue number when doing an SVN commit, automatically add a note to the Mantis 'notes' log containing info about the change, and show a link to the issue from TortoiseSVN log.

1. Set properties for your SVN repository (e.g. in TortoiseSVN, use the file properties dialog) to include the following:
bugtraq:label = issue
bugtraq:url = http:///mantis/view.php?id=%BUGID%
bugtraq:message = issue %BUGID%
bugtraq:warnifnoissue = true

2. Create a post commit hook file in the SVN respository hooks directory (\hooks\post-commit.bat), containing the following batch commands. This will add a comment to the notes field for the issue provided during the SVN commit, containing the SVN change log, the SVN revision number and the file differences.

REM Post-commit hook for MantisBT integration
SET LOG_FILE=\svnfile_%REV%_Log

echo ****** Source code change ******>>%DETAILS_FILE%
svnlook log -r %REV% %REPOS%>>%DETAILS_FILE%
echo SVN Revision:%REV%>>%DETAILS_FILE%
svnlook diff -r %REV% %REPOS%>>%DETAILS_FILE%

\php.exe \core\checkin.php <%DETAILS_FILE% >%LOG_FILE%

3. Add the following to your Mantis config_inc.php

#Integration to SVN
$g_source_control_notes_view_status = VS_PUBLIC;
$g_source_control_account = '';
$g_source_control_set_status_to = OFF;
$g_source_control_regexp = "/\bissue [#]{0,1}(\d+)\b/i";

1 comment:

Anonymous said...
This comment has been removed by a blog administrator.