Kristis,
It seems that in Bugzilla.pm, this function is never called
# Changes a bug resolution originating from the bug-tracking username
# of the SCM user
#
# PARAMETERS:
# $1 - Bug id
# $2 - Bug-tracker username of SCM user that will change the resolution
# $3 - New bug status
# $4 - Possible bug resolution
# $5 - Possible bug resolution data
#
# RETURNS:
# - 0 on success
# - 1,<a string describing the error> on failure
sub integration_change_bug_resolution {
my $self = shift;
my ( $bugid, $username, $status, $resolution, $resolution_data ) = ( @_
);
if ( $self->is_version_latest() ) {
my $privileges_are_required = 0; #Set within check_can_change_field,
not used at the moment
my $bug = new Bugzilla::Bug($bugid);
my $user = Bugzilla::User->new( { name => $username } );
Bugzilla->set_user($user);
my $dbh = Bugzilla->dbh;
my $sql = "UPDATE bugs SET ";
my $has_changed = 0;
my @params = ();
if(!defined $status) {
$status = "none";
} else {
$status = lc $status;
}
my $assignee = undef;
my $dupe_id = undef;
if ( $status =~ /^none$/ ) {
return ( 1, "Undefined status '$status' for bug '$bugid'.\n");
} elsif ( $status =~ /^assigned$/ ) {
if( defined($resolution) && ('' ne $resolution) ) {
# Reassign to given assignee
$assignee = $dbh->selectrow_array( "SELECT userid FROM
profiles WHERE " .
$dbh->sql_istrcmp('login_name', '?'), undef, $resolution);
if( $assignee == 0) {
return ( 1, "Unknown assignee '$resolution'.\n");
}
my %data = { 'knob' => 'reassign' }; #Needed by
check_can_change_field for correctness
if(!$bug->check_can_change_field('assigned_to',
$bug->assigned_to, $assignee, \$privileges_are_required, \%data)) {
return ( 1, "Missing permission to reassign bug.\n");
}
$sql .= "bug_status=?";
push(@params, 'NEW'); # NOT ASSIGNED, this would break bz
workflow
$sql .= ", assigned_to = ?";
push(@params, $assignee);
} else {
# Accepting bug
if($bug->assigned_to->id == 0) {
return ( 1, "Bug '$bugid' was never confirmed. Can't
change status to 'ASSIGNED'.\n");
}
if($bug->assigned_to->id != $user->id) {
return ( 1, "You cannot accept a bug if you aren't the
assignee. Bug '$bugid' is assigned to '" . $bug->assigned_to->login .
"'\n");
}
$sql .= "bug_status=?";
push(@params, 'ASSIGNED');
}
$has_changed = 1;
} elsif ( $status =~ /^reopened$/ ) {
if(!$bug->check_can_change_field('bug_status', $bug->bug_status,
uc $status, \$privileges_are_required)) {
return ( 1, "Missing permission to reopen bug.\n");
}
$sql .= "bug_status=?";
push(@params, uc $status);
$sql .= ", resolution=?";
push(@params, "");
$has_changed = 1;
} elsif ( $status =~ /^resolved$/ ) {
$resolution = lc $resolution;
if(!$bug->check_can_change_field('bug_status', $bug->bug_status,
uc $status, \$privileges_are_required)) {
return ( 1, "Missing permission to resolve bug.\n");
}
if((!defined $resolution) || ('' eq $resolution)) {
return ( 1, "Undefined resolution for status '$status'.\n");
}
if($resolution eq "moved") {
# Should never happen, anyway leave it here
return ( 1, "Movement of bugs isn't supported.\n");
} elsif ($resolution eq "duplicate") {
$dupe_id = $resolution_data;
my $reporter = $dbh->selectrow_array( "SELECT reporter FROM
bugs WHERE bug_id = ?", undef, $dupe_id);
my $reporter_user = Bugzilla::User->new($reporter);
if (!$reporter_user->can_see_bug($dupe_id)) {
# We don't want to be verbose to the user here, because
he doesn't have the permissions
return ( 1, "Error while setting status of bug '$bugid'
to 'resolved duplicate $resolution_data'.\n");
}
}
$sql .= "remaining_time = 0"; #Must reset time in this case, is
also done in bugzilla's process_bug.cgi
$sql .= ", bug_status=?";
push(@params, uc $status);
$sql .= ", resolution=?";
push(@params, uc $resolution);
$has_changed = 1;
} else {
return ( 1, "Unknown status '$status' for bug '$bugid'.\n");
}
my $dbh = Bugzilla->dbh;
# Lock database tables, avoid mid-air collisions
$dbh->bz_lock_tables('bugs WRITE', 'bugs_activity WRITE',
'duplicates WRITE', 'longdescs WRITE', 'fielddefs READ', 'profiles READ');
my $timestamp = $dbh->selectrow_array("SELECT NOW()"); # use same
timestamp for all modifications
$sql .= " WHERE bug_id = ?";
push(@params, $bugid);
if ($has_changed == 1) {
my $result = $dbh->do($sql, undef, @params);
if($result) {
if ($resolution ne 'duplicate') {
# Remove if previous resolution was duplicate
$dbh->do( "DELETE FROM duplicates WHERE dupe = ?",
undef, $bugid);
} else {
# Remove previous one if dupe has changed
$dbh->do( "DELETE FROM duplicates WHERE dupe = ?",
undef, $bugid);
if($dbh->do( "INSERT INTO duplicates VALUES (?, ?)",
undef, $dupe_id, $bugid)) {
# Simulate bugzilla behavior when marking as
duplicate
Bugzilla::Bug::AppendComment($bugid, $user->id, "",
0, $timestamp, 0, Bugzilla::Constants->CMT_DUPE_OF, $dupe_id);
Bugzilla::Bug::AppendComment($dupe_id, $user->id,
"", 0, $timestamp, 0, Bugzilla::Constants->CMT_HAS_DUPE, $bugid);
}
}
# Finally add values to bug's activity log
my $bug2 = new Bugzilla::Bug($bugid);
if( defined($assignee) && ( $bug->assigned_to->id !=
$bug2->assigned_to->id)) {
my $old_value =
Bugzilla::User::user_id_to_login($bug->assigned_to->id);
my $new_value =
Bugzilla::User::user_id_to_login($bug2->assigned_to->id);
Bugzilla::Bug::LogActivityEntry($bugid, 'assigned_to',
$old_value, $new_value, $user->id, $timestamp);
}
if($bug->bug_status ne $bug2->bug_status) {
Bugzilla::Bug::LogActivityEntry($bugid, 'bug_status',
$bug->bug_status, $bug2->bug_status, $user->id, $timestamp);
}
if($bug->resolution ne $bug2->resolution) {
Bugzilla::Bug::LogActivityEntry($bugid, 'resolution',
$bug->resolution, $bug2->resolution, $user->id, $timestamp);
}
} else {
$dbh->bz_unlock_tables();
return ( 1, "Error while updating the status resolution of
bug 'bugid'.\n");
}
}
$dbh->bz_unlock_tables();
if($has_changed == 1){
return 0;
} else {
return ( 1, "Changing bug resolution for bug '$bugid' wasn't
successful. Nothing changed.\n");
}
}
######Log comments start here#########
open LOGFILE, ">> /tmp/resolvelogfile";
print LOGFILE "bugid: '$bugid', status: '$status', $resolution:
'$resolution', $resolution_data: '$resolution_data'\n";
######Ends here#######################
return ( 1, "Changing bug resolution is not yet implemented in this
version of Bugzilla.\n");
}
The resolvelogfile is never created.
Thanks,
Manjit
-----Original Message-----
From: manjit [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 07, 2008 3:33 PM
To: 'Kristis Makris'
Cc: '[email protected]'
Subject: RE: [scmbug-users] RE: log comments not reflected in Bugzilla
I tried adding the debug in daemon Bugzilla.pm (attached) as per your
instructions in the previous mail. It created the logfile (attached) for
once and then it failed to update/create the same. But I can see lots of
consolidated activities file created in the same tmp folder (attached one
such). Still it leads me nowhere to proceed.
Thanks,
Manjit
-----Original Message-----
From: Kristis Makris [mailto:[EMAIL PROTECTED]
Sent: Wednesday, February 06, 2008 10:45 PM
To: manjit
Cc: [email protected]
Subject: RE: [scmbug-users] RE: log comments not reflected in Bugzilla
On Wed, 2008-02-06 at 11:24 +0530, manjit wrote:
> I'm able to commit after changing the version number. But still the old
> problem persists. I don't any see the log comments updated in the
Bugzilla.
> I really doubt if scmbug is interacting with the db properly. Is there any
> way to find out what it is doing with the db? I am kinda really frustrated
> after spending so much time to make it up and running.
Manjit I understand that you are frustrated. Now that you have changed
back to 2.22.x, can you try changing the product name in glue.conf to an
invalid product name, and then trying to commit ? If you get an error
from Scmbug saying that the product name is invalid for the bug number
you specified, then indeed the Scmbug daemon is talking to the database
properly.
If this works, then you will need to apply modifications to the daemon
as I've described before in a previous email (writing *YOUR OWN* logging
statements to /tmp/debuglog) and try *YOURSELF* to figure out where the
Scmbug daemon stops responding. You need to help out here. I can't do
this debugging for you.
I'm sorry for the state of things, but this is what needs to happen to
find out what the daemon is doing.
_______________________________________________
scmbug-users mailing list
[email protected]
http://lists.mkgnu.net/cgi-bin/mailman/listinfo/scmbug-users