Mantis Logo
Mantis Manual
Manual
Configuration

Database
Path
Webserver
Version
Email
Language
Display
Time
JpGraph
Date
News
Default Preferences
Summary
Bugnote
File Upload
HTML
Authentication
Status Settings
Filters
Misc
Colors
Cookies
Database Tables
Speed Optimisation
Reminders
Bug History
Sponsorship
Source Control Integration
Custom Fields
My View Settings
Relationships
System Logging


Partner Links


Source Control Integration
Last Modified: August 12, 2005 08:08AM
(Introduced in 0.19.0)
Description

$g_source_control_account Account to be used by the source control script. The account must be enabled and must have the appropriate access level to add notes to all issues even private ones (DEVELOPER access recommended). The default is '' (not set).
$g_source_control_notes_view_status This sets whether the note added will be public or private (VS_PUBLIC or VS_PRIVATE). For open source projects it is expected that the notes be public, however, for non-open source it will probably be VS_PRIVATE. The default is VS_PRIVATE.
$g_source_control_set_status_to If set to a status, then after a checkin, the issue status is set to the specified status, otherwise if set to OFF, the issue status is not affected. The default is OFF.
$g_source_control_regexp Regular expression used to detect issue ids within checkin comments. See preg_match_all() documentation for more details on setting a pattern. The default is "/\bissue [#]{0,1}(\d+)\b/i" (e.g., issue #745).


User Contributed Notes
Source Control Integration
Add Notes About Notes
balazs@bwellisch.com
28-Sep-2004 20:15
#212
Is there any documentation beyond what's here on how Source Control integration works?
Victor @ Mantis
29-Sep-2004 0:16
#213
Not at the moment. This integration is still at its early stages. However, what happens at the moment is that the core/checkin.php script reads in a log message from stdin and parses it and adds the issue notes accordingly. You can insert calls to this script in loginfo file in CVSROOT.

I will write a detailed copied on this feature when I get a chance.

Regards,
Victor.
kristen@paristemi.com
04-Oct-2004 13:21
#222
I would like to second the vote for documentation on the CVS integration.
don1twantspam
15-Dec-2004 6:10
#288
Subversion-Integration would be nice, too! It shouldn't be too hard since you can tell svn to produce xml of the log messages.

- twm
ivanassen@gplease.dont.spammail.com
29-Dec-2004 17:17
#302
Subversion integration worked completely out of the box for me, just a matter of setting the regular expression to match the Bug ID note in the commit log, emitted by TortoiseSVN according to its bugtraq properties.
trclark@shaw.ca
13-Jan-2005 14:26
#321
from http://www.silfreed.net/blog/272
a netMgr Integration script http://www.netmrg.net/

cvs loginfo
netmrg /usr/bin/php -q /path/to/mantisbt/core/checkin.php
ALL /usr/local/bin/syncmail -S "NetMRG-CVS: " -R return@addr --quiet %%s to@addr

mantisbt config_inc.php
$g_source_control_notes_view_status = VS_PUBLIC;
$g_source_control_account = 'netmrgcvs';
$g_source_control_set_status_to = OFF;
$g_source_control_regexp = "/bug\s*[#]{0,1}(\d+)/i";
antti.tuppurainen@gmail.com
14-Mar-2005 10:15
#377
Hi!

My /usr/local/cvsroot in owned by cvsuser:cvsusers with chmod wxr,wxr,w-r

The config_inc.php file contains:
$g_source_control_account = 'cvsuser';


the cvsroot/CVSROOT/verifymsg has

DEFAULT /usr/bin/php -q /srv/www/htdocs/mantis/core/checkin.php

The checkin.php has the changes mentioned abow (actually tested also the original version). Now I get the error
cvs commit: warning: verifymsg line doesn't contain any format strings:
    "/usr/bin/php -q /srv/www/htdocs/mantis/core/checkin.php"
Appending default format string (" %l";), but be aware that this usage is
deprecated.
Invalid source control account ('cvsuser').
cvs [commit aborted]: Message verification failed


Where I should start debugging?
antti.tuppurainen@gmail.com
14-Mar-2005 10:17
#378
actually tried these instructions:
http://manual.mantisbt.org/manual.installation.cvs.integration.php
mike.junk@NOntlworldSPAM.com
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://<mantisserver>/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 (<repositorypath>\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 REPOS=%1
SET REV=%2
SET DETAILS_FILE=<valid_path>\svnfile_%REV%
SET LOG_FILE=<valid_path>\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%

<PathToPHP>\php.exe <PathToMantis>\core\checkin.php <%DETAILS_FILE% >%LOG_FILE%
DEL %DETAILS_FILE%
DEL %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 = '<ValidMantisUser>';
$g_source_control_set_status_to = OFF;
$g_source_control_regexp = "/\bissue [#]{0,1}(\d+)\b/i";
victor @ mantis
15-Jun-2005 10:08
#473
This is a post by Leonel on mantisbt-dev on 11-JUN-2005:

My goal was to add a bugnote if the commit message contains a "issue 1234" string. and add a bugnote and close the bug as resolved/fixed if the commit message has a "fixed issue 1234" string.
First step on this is the post-commit subversion hook. I think mantis should supply one as example. Thanks to Sean Laurent for having helped me getting started on this, here's my post-commit hook:

--- start here ---
#!/bin/sh

REPOS="$1"
REV="$2"

SVNLOOK=/usr/local/bin/svnlook
PHP=/usr/bin/php
MANTIS=/srv/www/novo/html/mantis/core/checkin.php
COMMIT_MSG=`$SVNLOOK log -r $REV "$REPOS"`

$PHP -f $MANTIS <<zzzMantiszzz
Revision: $REV: $COMMIT_MSG
zzzMantiszzz
--- end here ---
mkgnu@gmx.net
27-Jun-2005 13:51
#489
Why aren't you just using

http://freshmeat.net/projects/scmbug ?

Why are we back to square one all of the sudden ?
mj@sightworks.com
02-Jan-2006 13:52
#796
I would love to use SCMBUG, unfortunately the make fails on my Gentoo system (docbook2dvi generates a bunch of errors, something about undefined elements)
attila.strba@enocean.com
04-Jan-2006 6:09
#805
Hi,

does anybody know how to configure this SCMBUG for Mantis under Windows? I would like to connect the CVS with Mantis. I downloaded active perl, and tryed to compile the SCMBUG sources but I get plenty of errors. Any ideas??

Attila
evanl@NOSPAMreynoldsequipment.com
11-Jan-2006 14:00
#824
I have source control integration working quite well.

A bug is reported, someone assigns it to a developer, the developer fixes the bug and checks in the changes to SVN with TortoiseSVN, putting the bug number in the "Mantis Issue #" box (bugtraq folder properties provide this). The bug is then marked resolved if 'Fixed #xxx" is found (added in the message manually). The bugnote is added using a SVN post-comit and checkin.php. Further, in WebSvn, there will now appear a link to the Mantis bug (bugtraq).

Mantis will also show a link to its own bug number in the bugnote from the SVN commit. I'd prefer to it to be a link to WebSVN, or pull in the revision of the commit as "Revision XXX' and make *it* a link to WebSVN. Right now it throws away the revision number, and reporting it would be nice. Its somewhat pointless to have a bugnote point to its own bug number. Is there a way to fudge this without losing other functionality? This would be really handy.

Secondly, I'm keying off "#xxx' to link to bugnotes. There is also a '~xxx' for bugnote links. How is this intended to be used? Is this only to link one bugnote to another bugnote within the same bug?

Ideas?
simon.kirk@pinesoft.co.uk
01-Mar-2006 9:16
#908
Slightly OT, but: To the guy trying to get scmbug built with gentoo: Yup, the error (well, it's not really an error) is in the way scmbug builds it's man pages and manual: Via SGML pages transformed into the relevant type.

You can get scmbug to build if you get the relevant scmbug release package, unpack it, edit the Makefile to omit the copying of the man pages (the ebuild omits the manual anyway) in the install targets, repackage and shove it in your /usr/portage/distfiles. You won't have any man pages available, but they're on the web anyway!

The reason I've bothered to mention it is that scmbug is a really nice attempt to get integration between defect management and SCM working, and I think it should have a lot more exposure (I'm currently tweaking it to get it working for Mantis right now - on my Gentoo dev server :).
mkgnu@mkgnu.net
03-Mar-2006 12:23
#909
Attila:

Try using the Scmbug .zip provided for Windows. It's already prepackaged, and ready for uncompressing and using in Windows
kukovec@iskratel.si
01-Jun-2006 7:56
#1106
Hello!

I'm trying to integrate Mantis with Subversion. I did every thing like mike.junk@NOntlworldSPAM.com said on 25-Apr-2005 11:11 #419 Brief guide to TortoiseSVN integration on Win32.

Every thing looks ok, but my subversionserver which is accessed trough apache just don't start hooks (windows machine). I read subversion manual on hooks word by word and did exactly what I was instructed too, but hooks are just not executed. I put some simple batch files that creates some output to a file. After it I do some action on the subversion db (commit, lock, unlock, etc.). Hooks are just not executed.

Any ideas?
kukovec@iskratel.si
01-Jun-2006 8:59
#1107
Hello?

I solved the problem on the previous question. Absolute paths to the executable programs have to be called from the batch files. Echo will also not be seen because batch file is run by the process and not by the user.

Now I woder if there is any way to adaptively change $g_source_control_account so not all comments will be visible in Mantis as they are always added from the same user. Can be done somehow that $g_source_control_account is different depends on who is making commit?
kukovec@iskratel.si
01-Jun-2006 9:08
#1108
Hello!

It can be done like in the case of

$g_source_control_regexp = "/\bissue [#]{0,1}(\d+)\b/i";

for the issue number. I will do the same for the user. I will inform you of the solution.
cschwarz@hbsconnect.com
11-Jul-2006 12:19
#1188
it would be great to have a setting to make it mandatory to enter the Mantis Bugnumber when committing code to Subversion as this makes it easier to track the code changes in Mantis also
brian.hnat at NOSPAM gmail dot com
26-Jul-2006 21:32
#1202
#1188
#1189
You can do this with a pre-commit hook in subversion (in the hooks directory of your repository). Here's an example:

#!/usr/bin/perl

$repos = $ARGV[0];
$txn = $ARGV[1];
$svnlook = "/usr/bin/svnlook";
$svncmd = $svnlook." log -t ".$txn." ".$repos." |";

open (CMD, $svncmd);
@commitmsg = <CMD>;
close (CMD);

foreach $line (@commitmsg)
{
  $msg = $msg.$line;
}

if ( $msg !~ /\bissue [#]{0,1}(\d+)\b/ )
{
  die "Cannot commit file without mantis issue number";
}
clandriot@axway.com
22-Sep-2006 2:21
#1264
Hello.

I'm trying to set the source control integration with Subversive. My problem is that my Subversive server is not on the same machine machine as my Mantis server.
As I am a php newbie, I have not yet found how to launch the checkin.php script from the remote host.

Perhap's someone here could help me ?
vosskaem
07-Oct-2006 7:22
#1267
you can use ssh in your post-commit:

---snip---
MESSAGEFILE=/tmp/svn.$$
SSH=/usr/bin/ssh

# Path to checkin.php on your webserver
MANTIS=/var/www/mantis/core/checkin.php

# ...
# create your message
# ...

$SSH www-data@your.web.server "(cd /tmp; php -f $MANTIS)" < $MESSAGEFILE
rm $MESSAGEFILE
---snip---

you only have to setup your servers for passwordless ssh authentication

 
vosskaem at cenote dot de
07-Oct-2006 7:35
#1268
but I have a problem executing checkin.php on the same host:

# php -f /var/www/mantis/core/checkin.php < messagefile
Fatal error: Call to undefined function mysql_pconnect() in /var/www/mantis/core/adodb/drivers/adodb-mysql.inc.php on line 355

can anyone help me?
I'm runnig mantis 1.0.5 on ubuntu dapper drake with php5 and everything else works fine
kier@mogware.com
02-Nov-2006 20:13
#1286
I have been trying to setup the windows integration and I have everything working except the php part the of post-commit.bat mentioned above.

Does anyone know if I call call a local copy(one found on a local machine) of php.exe and pass the path to the checkin.php as shown below?

I keep getting the following error from the php log:
  Status: 404
  X-Powered-By: PHP/4.4.4
  Content-type: text/html

  No input file specified.


::*************************************
::post-commit.bat
::*************************************
REM Post-commit hook for MantisBT integration
SET REPOS=%1
SET REV=%2
SET DETAILS_FILE=U:\SVN_LOGS\svnfile_%REV%
SET LOG_FILE=U:\SVN_LOGS\svnfile_%REV%_Log
 
echo ****** Source code change ******>>%DETAILS_FILE%
\\MACHINENAME\bin\svnlook log -r %REV% %REPOS%>>%DETAILS_FILE%
echo SVN Revision:%REV%>>%DETAILS_FILE%
\\MACHINENAME\bin\svnlook diff -r %REV% %REPOS%>>%DETAILS_FILE%

\\MACHINENAME\php\php.exe http://bugs.myweb.com/core/checkin.php <%DETAILS_FILE%> %LOG_FILE%
DEL %DETAILS_FILE%
DEL %LOG_FILE%
r.a.smith
12-Nov-2006 22:38
#1291
Regarding the Fatal error: undefined function mysql_connect()
problem in Ubuntu Drake (note #1268)

This problem also occurs in Debian Sarge, where it can be corrected
by adding a line to /etc/php4/cli/php.ini:

extension=mysql.so

This line is already in the web-server versions of php.ini, so no such
problem arises when using the web interface.
thomas.delhomenie@NOSPAMgmail.com
22-Dec-2006 9:29
#1322
Hi !

I've got CVS and Mantis on different machines. PHP is only installed on the Mantis machine.

When I try to execute the following command from a DOS window :
\\pcdsi556\vol_d$\EasyPHP\php\php pcdsi556\vol_d$\weblocal\mantis-1.0.6\co
re\checkin.php

I've got the following error :
PHP Warning: Unknown(): Unable to load dynamic library './php_gd2.dll' - Le module spÚcifiÚ est introuvable. in Unknown on line 0

Is there a way to add the needed line in the commitinfo file with our configuration ?

Thomas
pirsl@kangaroo.at
05-Jan-2007 8:03
#1337
here an useful link.
http://alt-tag.com/blog/archives/2006/11/integrating-mantis-and-subversion/
Add Notes About Notes
Last updated: Fri, 16 May 2008 - 13:06:20

Mantis @ SourceForge