Hey Guys,
basic functionality for svn / mantis is added.
there nearly no checks if the entered status/resolution makes sense
(like resolved/open).
You find the actual diff (src) attatched.
Sven Ludwig
Only in dev/system: Makefile
Only in dev/system: autom4te.cache
Only in dev/system: config.log
Only in dev/system: config.status
Only in dev/system: configure
Only in dev/system/doc/manpages: Makefile
Only in dev/system/doc/manual: Makefile
Only in dev/system/doc/paper_introduce: Makefile
Only in dev/system/packaging/debian: control
Only in dev/system/packaging/debian: rules
Only in dev/system: product_release.conf
diff -ur ori/system/src/lib/product/Daemon/Integration.pm.in
dev/system/src/lib/product/Daemon/Integration.pm.in
--- ori/system/src/lib/product/Daemon/Integration.pm.in 2007-07-10
15:41:00.000000000 +0200
+++ dev/system/src/lib/product/Daemon/Integration.pm.in 2007-07-10
17:47:03.000000000 +0200
@@ -377,7 +377,7 @@
if ( $request->{ policies }->{ resolution_template }->{ enabled } ) {
foreach my $resolution_id ( sort keys %{ $request->{ resolution_ids } }
) {
- my ( $retval, $retval_string ) =
$self->bugtracker()->integration_change_bug_resolution( $resolution_id,
$username, $request->{ resolution_ids }->{ $resolution_id }->{ status } );
+ my ( $retval, $retval_string ) =
$self->bugtracker()->integration_change_bug_resolution( $resolution_id,
$username, $request->{ resolution_ids }->{ $resolution_id }->{ status } ,
$request->{ resolution_ids }->{ $resolution_id }->{ resolution });
if ( $retval != 0) {
$request->add_result( 1, $retval_string );
return 1;
diff -ur ori/system/src/lib/product/Daemon/Mantis.pm.in
dev/system/src/lib/product/Daemon/Mantis.pm.in
--- ori/system/src/lib/product/Daemon/Mantis.pm.in 2007-07-10
15:41:00.000000000 +0200
+++ dev/system/src/lib/product/Daemon/Mantis.pm.in 2007-07-10
17:09:29.000000000 +0200
@@ -64,7 +64,18 @@
80 => 'block'
};
-
+# Numerig bug resolution values
+my $mantis_bug_resolution_map = {
+ 10 => 'open',
+ 20 => 'fixed',
+ 30 => 'reopened',
+ 40 => 'unable to reproduce',
+ 50 => 'not fixable',
+ 60 => 'duplicate',
+ 70 => 'no change required',
+ 80 => 'suspend',
+ 90 => 'won\'t fix'
+};
# There are various ways to talk to Mantis. The Mantis API as
# provided by the Mantis source using the globals.pl file is used
@@ -118,10 +129,12 @@
sub mantis_bug_status_tostring {
+ my $self = shift;
my $bug_status_number = shift;
my $bug_status_string;
$bug_status_string = $mantis_bug_status_map->{ $bug_status_number }->{
name };
+
if ( !defined( $bug_status_string) ) {
$bug_status_string = $BUG_STATUS_INVALID_STRING;
}
@@ -130,6 +143,25 @@
}
+sub mantis_bug_status_string_toint {
+ my $self = shift;
+ my $bug_status_string = shift;
+ my $bug_status_number;
+
+ foreach (keys (%{ $mantis_bug_status_map })) {
+ if ($mantis_bug_status_map->{ $_ }->{ name } eq $bug_status_string) {
+ $bug_status_number = $_;
+ last;
+ }
+ }
+
+ if ( !defined( $bug_status_number) ) {
+ $bug_status_number = $BUG_STATUS_INVALID_STRING;
+ }
+
+ return $bug_status_number;
+}
+
sub mantis_bug_priority_tostring {
my $bug_priority_number = shift;
@@ -157,6 +189,24 @@
return $bug_severity_string;
}
+sub mantis_bug_resolution_string_toint {
+ my $self = shift;
+ my $bug_resolution_string = shift;
+ my $bug_resolution_number;
+
+ foreach (keys (%{ $mantis_bug_resolution_map })) {
+ if ($mantis_bug_resolution_map->{ $_ } eq $bug_resolution_string) {
+ $bug_resolution_number = $_;
+ last;
+ }
+ }
+
+ if ( !defined( $bug_resolution_number) ) {
+ $bug_resolution_number = $BUG_STATUS_INVALID_STRING;
+ }
+
+ return $bug_resolution_number;
+}
#
@@ -391,16 +441,42 @@
# PARAMETERS:
# $1 - Bug id
# $2 - Bug-tracker username of SCM user that will change the resolution
-# $3 - New resolution
+# $3 - New status
+# $4 - New resolution
#
# RETURNS:
# - 0 on success
# - 1,<a string describing the error> on failure
sub integration_change_bug_resolution {
my $self = shift;
- my ( $bugid, $username, $resolution ) = ( @_ );
+ my ( $bugid, $username, $status, $resolution ) = ( @_ );
+
+ # Make string values fit the int system of Mantis
+ $status = $self->mantis_bug_status_string_toint($status);
+ $resolution = $self->mantis_bug_resolution_string_toint($resolution);
+
+ # Find the reporter_id, needed by the comment insertion
+ my $sql = "SELECT id from mantis_user_table WHERE username=?";
+ my $reporter_id = $self->mantis_fetch_column( $sql, 'id', $username);
- return ( 1, "Changing bug resolution is not yet implemented in this
version of Mantis.\n");
+ # Find the old value of status
+ my $sql = "SELECT status from mantis_bug_table WHERE id=?";
+ my $status_old_value = $self->mantis_fetch_column ( $sql, 'status',
int($bugid) );
+
+ # Find the old value of status
+ my $sql = "SELECT resolution from mantis_bug_table WHERE id=?";
+ my $resolution_old_value = $self->mantis_fetch_column ( $sql,
'resolution', int($bugid) );
+
+ # Update the History
+ my $sql = "INSERT INTO mantis_bug_history_table(user_id, bug_id,
date_modified, field_name, old_value, new_value, type)
VALUES(?,?,now(),?,?,?,0)";
+ $self->mantis_issue_sql( $sql, $reporter_id, $bugid, 'status',
$status_old_value, $status);
+ $self->mantis_issue_sql( $sql, $reporter_id, $bugid, 'resolution',
$resolution_old_value, $resolution);
+
+ # Update the Status and Resolution of the bug
+ my $sql = "UPDATE mantis_bug_table SET status = ?, resolution = ? WHERE id
= ?";
+ $self->mantis_issue_sql( $sql, $status, $resolution, $bugid );
+
+ return 0;
}
@@ -538,11 +614,12 @@
$bug_status = $self->mantis_fetch_column( $sql, 'status', $bugid );
+ $bug_status = $self->mantis_bug_status_tostring( $bug_status );
+
return $bug_status;
}
-
# Given a bug id, returns 1 if the bug is in a state considered
# active, or 0 otherwise. Active bug state examples would be
# "assigned" and "reopened". A bug can accept checkins in this
@@ -555,13 +632,13 @@
sub integration_bug_in_active_state {
my $self = shift;
my $bugid = shift;
- my $bug_status = $self->integration_get_bug_status( $bugid );
+ my $bug_status =
$self->mantis_bug_status_string_toint($self->integration_get_bug_status( $bugid
));
# Verify that the bug is in the assigned state
if ( $mantis_bug_status_map->{ $bug_status }->{ active } == 1 ) {
- return (1, mantis_bug_status_tostring( $bug_status ) );
+ return (1, $self->mantis_bug_status_tostring( $bug_status ) );
} else {
- return (0, mantis_bug_status_tostring( $bug_status ) );
+ return (0, $self->mantis_bug_status_tostring( $bug_status ) );
}
}
@@ -886,6 +963,10 @@
return $mergelist, $ret_val, $ret_message;
}
+sub integration_bug_resolution_change_is_valid {
+ my $this = shift;
+ return 1;
+}
-1;
+;
Only in dev/system/src/tests: Makefile
_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users