User: sits    
  Date: 08/02/21 16:56:21

  Modified:    lib/Codestriker/BugDB BugzillaConnection.pm
                        FlysprayConnection.pm TestDirectorConnection.pm
               lib/Codestriker/Model Topic.pm
               lib/Codestriker/TopicListeners BugTracking.pm
  Log:
  Rob's changes for allowing TestDirector records to be removed when a topic 
review is deleted
  
  
  
  Index: BugzillaConnection.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/BugDB/BugzillaConnection.pm,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- BugzillaConnection.pm     13 Jan 2008 09:15:22 -0000      1.6
  +++ BugzillaConnection.pm     22 Feb 2008 00:56:21 -0000      1.7
  @@ -45,8 +45,8 @@
   
   # Method for updating the bug with information that a code review has been
   # created/closed/committed against this bug.
  -sub update_bug($$$$) {
  -    my ($self, $bugid, $comment, $topic_url) = @_;
  +sub update_bug($$$$$) {
  +    my ($self, $bugid, $comment, $topic_url, $topic_state) = @_;
   
       # Create the necessary prepared statements.
       my $insert_comment =
  
  
  
  
  
  Index: FlysprayConnection.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/BugDB/FlysprayConnection.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- FlysprayConnection.pm     13 Jan 2008 09:15:22 -0000      1.5
  +++ FlysprayConnection.pm     22 Feb 2008 00:56:21 -0000      1.6
  @@ -46,8 +46,8 @@
   
   # Method for updating the bug with information that a code review has been
   # created/closed/committed against this bug.
  -sub update_bug($$$$) {
  -    my ($self, $bugid, $comment, $topic_url) = @_;
  +sub update_bug($$$$$) {
  +    my ($self, $bugid, $comment, $topic_url, $topic_state) = @_;
   
       # Create the necessary prepared statements.
       my $insert_comment =
  
  
  
  
  
  Index: TestDirectorConnection.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/BugDB/TestDirectorConnection.pm,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TestDirectorConnection.pm 21 Feb 2008 02:32:09 -0000      1.2
  +++ TestDirectorConnection.pm 22 Feb 2008 00:56:21 -0000      1.3
  @@ -73,9 +73,9 @@
   }
   
   # Method for updating the bug with information that a code review has been
  -# created/closed/committed against this bug.
  -sub update_bug($$$$) {
  -    my ($self, $bugid, $comment, $topic_url) = @_;
  +# created/closed/committed/deleted against this bug.
  +sub update_bug($$$$$) {
  +    my ($self, $bugid, $comment, $topic_url, $topic_state) = @_;
   
       # Now get the bug out of Test Director.
       my $bug = $self->_retrieve_bug_record($bugid);
  @@ -94,10 +94,14 @@
       $full_comment .= "</BODY></HTML>\n";
   
       if (defined $bug->Attachments) {
  -        my $attach = $bug->Attachments->AddItem([$topic_url,
  -                                              "TDATT_INTERNET",
  -                                              $full_comment]);
  -        $attach->post();
  +        if( $topic_state eq "Deleted" ) {
  +            $self->_update_bug_delete( $bug->Attachments, $topic_url );
  +        } else {
  +            my $attach = $bug->Attachments->AddItem([$topic_url,
  +                                                  "TDATT_INTERNET",
  +                                                  $full_comment]);
  +            $attach->post();
  +        }
       }
       else
       {
  @@ -106,4 +110,27 @@
       }
   }
   
  +# Method for updating the bug with information that a code review has been
  +# deleted against this bug.
  +sub _update_bug_delete($$$) {
  +    my ($self, $attachments, $topic_url) = @_;
  +
  +    if( $attachments ) {
  +     my $attachment_list = $attachments->NewList("");
  +
  +     my $attach_counter = 1;
  +     while ( $attach_counter <= $attachment_list->Count ) {
  +         my $attachment = $attachment_list->Item($attach_counter);
  +
  +         if( $attachment->Name eq $topic_url ) {
  +             # Remove the attachment for the deleted topic
  +             $attachments->RemoveItem($attachment->ID);
  +         }
  +         $attach_counter++;
  +     }
  +     $attachments->post();
  +    }
  +}
  +
  +
   1;
  
  
  
  
  
  Index: Topic.pm
  ===================================================================
  RCS file: /cvsroot/codestriker/codestriker/lib/Codestriker/Model/Topic.pm,v
  retrieving revision 1.48
  retrieving revision 1.49
  diff -u -r1.48 -r1.49
  --- Topic.pm  7 Mar 2007 01:12:32 -0000       1.48
  +++ Topic.pm  22 Feb 2008 00:56:21 -0000      1.49
  @@ -1045,6 +1045,9 @@
   
       Codestriker::DB::DBI->release_connection($dbh, $success);
   
  +    # Update the topic state to deleted
  +    $self->{topic_state} = "Deleted";
  +
       # Indicate the success of the operation.
       return $success ? $Codestriker::OK : $Codestriker::INVALID_TOPIC;
   }
  
  
  
  
  
  Index: BugTracking.pm
  ===================================================================
  RCS file: 
/cvsroot/codestriker/codestriker/lib/Codestriker/TopicListeners/BugTracking.pm,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- BugTracking.pm    13 Jan 2008 09:15:22 -0000      1.5
  +++ BugTracking.pm    22 Feb 2008 00:56:21 -0000      1.6
  @@ -124,7 +124,7 @@
            "State changed to \"$newstate\" by $user\n";
               
        for (my $i = 0; $i <= $#ids; $i++) {
  -         $bug_db_connection->update_bug($ids[$i], $text, $topic_url);
  +         $bug_db_connection->update_bug($ids[$i], $text, $topic_url, 
$topic->{topic_state});
        }
        $bug_db_connection->release_connection();
       }
  
  
  

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Codestriker-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/codestriker-commits

Reply via email to