Mantis Bug Tracker
 

View Issue Details Jump to Notes ] Wiki ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0008847mantisbtintegrationpublic2008-02-01 06:092009-03-03 12:47
Reportersimpson_2 
Assigned Tojreese 
PrioritynormalSeverityfeatureReproducibilityN/A
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version1.1.0 
Target VersionFixed in Version1.1.6 
Summary0008847: Revamp SVN and CVS integration
DescriptionThe SVN and CVS integration can be extended to work more integrated without to much troubles. Some features I've added to make it work better:

1) Remote SVN or CVS server:
In the current implementation Mantis and the source control server should be on the same machine, or you need to install mantis on your source control server with access to the remote database.

2) When using a dedicated source control account, users who commit their work to the source control server do not get the credits for closing the bug.
Additional InformationFor both issues I've created a 'fix':

1)
I've modified and moved ./core/checkin.php to ./checkincurl.php
in the post_commit/logingfo hook you call curl which posts a form to the right address. this form contains 2 fields user & log, where user is the CVS / SVN user, and log is the log message.

checkincurl.php checks that the remote server is from a allowed IP ( configurable through config_inc.php ) and tries to login with the supplied user ( see point (2) ) for more info. ) it then works exactly like ./core/checkin.php

2)
I've added a field to the user table, and a procedure to user_api.php to retrieve a use by source control ID, there is no UI addition to set these fields on a user yet.

I hope I find time this weekend, to diff against the original source, and upload here.
TagsNo tags attached.
Attached Files? file icon checkincurl.php [^] (3,705 bytes) 2008-02-04 16:34 [Show Content]
diff file icon user_api.diff [^] (835 bytes) 2008-02-04 16:40 [Show Content]
? file icon post-commit [^] (2,271 bytes) 2008-02-04 16:43

- Relationships

-  Notes
User avatar (0016946)
simpson_2 (reporter)
2008-02-04 16:46

i've uploaded 3 files for SVN support.
a diff for core/user_api.php
which adds a function to get a user based on a source control account.
( this needs a extra column to the user table, but thats rather obvious )

then checkincurl.php which will react on posted information, needs a extra config setting: $g_source_control_server to hold the IP of the SVN server.

post-commit, a SVN control file.

todo:
add UI to set the SVN account, most probably this should only be allowed by admins though
User avatar (0017396)
vboctor (administrator)
2008-03-17 14:51

Thanks simpson_2 for your contribution. I haven't looked in too much details but following are my comments:

1. The configuration option for source control server should be an array. If empty, then this feature should be disabled, otherwise, the remote address should be validated against the array.

2. It would be useful if this feature supports logging. I expect that when using a third party source control service provider (e.g. SourceForge), you may not know the IPs upfront and you may want to log the attempts from IPs that are not yet in the list in order to add them.

3. The GUI associated with the source control user name.

4. Update for admin/schema.php to add the source control user name and an index on it.

5. Refactor the original checkin script and your curl checkin script so that the common code lives in core/source_control_api.php (i.e. create a new API).

6. Send a message to mantisbt-dev mailing list to get other developers' feedback. It would be great if one day the integration is more than just notes and auto-resolving / closing of issues.
User avatar (0017402)
jreese (administrator)
2008-03-18 11:11

I'm currently working on a source control integration plugin, that will support any source control system interacting with an abstracted API, and will track changesets separate from the way bugnotes are tracked. My initial support will only include SVN, as that's what my employer requires, but the system will be designed with other types of VCS in mind, such as Git/Mercurial, CVS, etc.
User avatar (0017541)
simpson_2 (reporter)
2008-04-02 15:41

Is there stil interest , or will the plugin handle all of this ??
User avatar (0017543)
jreese (administrator)
2008-04-02 20:10

Can you give a complete diff/patch against the latest SVN trunk? I'd like to take a look at how it works, because even with my upcoming plugin, Mantis needs to maintain its existing integration system for back compatibility reasons, and any easy enhancements that are useful without breaking existing functionality should be welcome. So if you can post a patch against the latest SVN trunk, then I'll look into the system and either give you some feedback, or pull out the parts that I think are feasible for maintaining the current integration.
User avatar (0017927)
vboctor (administrator)
2008-05-28 02:31

Here is a forum thread that refers to a contributed script to help with working with a remote SVN:
http://www.mantisbt.org/forums/viewtopic.php?f=4&t=4851 [^]
User avatar (0019394)
kauton (reporter)
2008-09-12 10:29

Any chance you make a Windows command prompt script similar to the post-commit already attached?
User avatar (0020081)
klkl (reporter)
2008-11-27 11:01

I think that post-commit hook may send invalid data when description contains "&" character:

 "user=$auth&log=Changeset [${REV}] $n$log$n$changed"

Arguments should be URL-encoded first.
User avatar (0020274)
thraxisp (manager)
2008-12-06 17:57

A cleaned version of the checkincurl.php script was submitted for 1.1.6.

Note that the message passed to the script may need to be URL-encoded depending on your version of curl. The script I use for CVS is below:

! /bin/bash
# gather up cvs info and pass to Mantis back end
#
tmp=`mktemp cvs.msg.XXXXXX`
tmp2=`mktemp cvs.emsg.XXXXXX`
# get log message, add file names and url encode it to preserve formatting
cat > /tmp/$tmp
echo -n 'log=' > /tmp/$tmp2
perl -pe 's/([^-_.~A-Za-z0-9])/sprintf("%%%02X", ord($1))/seg' /tmp/$tmp >> /tmp/$tmp2
curl -s -d user="${CVSUSER:-${USER}}" -d @/tmp/$tmp2 "http://<host>/mantis/core/checkincurl.php" [^]
rm /tmp/$tmp /tmp/$tmp2
User avatar (0020305)
jreese (administrator)
2008-12-09 09:25

Marking as resolved for 1.1.6.
User avatar (0020373)
kauton (reporter)
2008-12-15 09:30

Any chance you post how to make this work under Windows?

- Issue History
Date Modified Username Field Change
2008-02-01 06:09 simpson_2 New Issue
2008-02-03 11:34 ejc Issue Monitored: ejc
2008-02-04 16:34 simpson_2 File Added: checkincurl.php
2008-02-04 16:40 simpson_2 File Added: user_api.diff
2008-02-04 16:43 simpson_2 File Added: post-commit
2008-02-04 16:46 simpson_2 Note Added: 0016946
2008-03-10 09:06 seiji Issue Monitored: seiji
2008-03-17 14:51 vboctor Note Added: 0017396
2008-03-17 14:51 vboctor Status new => acknowledged
2008-03-18 11:11 jreese Note Added: 0017402
2008-03-18 11:12 jreese Issue Monitored: jreese
2008-04-02 15:41 simpson_2 Note Added: 0017541
2008-04-02 20:10 jreese Note Added: 0017543
2008-04-03 04:49 Dos095-russ Issue Monitored: Dos095-russ
2008-04-09 10:29 marcink Issue Monitored: marcink
2008-04-09 10:31 crest Issue Monitored: crest
2008-05-14 05:37 vaidyagi Issue Monitored: vaidyagi
2008-05-28 02:31 vboctor Note Added: 0017927
2008-07-10 09:26 tibobo Issue Monitored: tibobo
2008-07-10 09:26 tibobo Issue End Monitor: tibobo
2008-07-22 12:49 MWEinNC Issue Monitored: MWEinNC
2008-08-14 15:14 grangeway Status acknowledged => assigned
2008-08-14 15:14 grangeway Assigned To => jreese
2008-08-16 20:18 cornchips Issue Monitored: cornchips
2008-09-12 10:29 kauton Note Added: 0019394
2008-09-12 10:30 kauton Issue Monitored: kauton
2008-11-27 11:01 klkl Note Added: 0020081
2008-12-06 17:57 thraxisp Note Added: 0020274
2008-12-09 09:25 jreese Note Added: 0020305
2008-12-09 09:25 jreese Status assigned => resolved
2008-12-09 09:25 jreese Fixed in Version => 1.1.6
2008-12-09 09:25 jreese Resolution open => fixed
2008-12-09 16:44 Anakha Issue Monitored: Anakha
2008-12-15 09:30 kauton Note Added: 0020373
2008-12-16 08:38 jreese Status resolved => closed
2008-12-22 10:48 gass Issue Monitored: gass
2009-02-25 08:34 lvalics Issue Monitored: lvalics
2009-03-03 12:47 MFWSchmidt Issue Monitored: MFWSchmidt


MantisBT 1.2.2 git master-1.2.x[^]
Copyright © 2000 - 2010 MantisBT Group
Time: 0.3080 seconds.
memory usage: 2,054 KB
Powered by Mantis Bugtracker