From be04e7e48977def76cce03934854afb471ceed40 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 27 Dec 2017 15:42:50 +0100 Subject: WIP: rename bug variable Signed-off-by: Florian Pritz --- Bugzilla/Migrate/Flyspray.pm | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm index 863fedafa..9d8949919 100644 --- a/Bugzilla/Migrate/Flyspray.pm +++ b/Bugzilla/Migrate/Flyspray.pm @@ -286,14 +286,14 @@ sub _read_bugs { LEFT OUTER JOIN $fsdb.${fsprfx}list_status ls ON ls.status_id = t.item_status LEFT OUTER JOIN $fsdb.${fsprfx}list_resolution lr ON lr.resolution_id = t.resolution_reason LEFT OUTER JOIN $fsdb.${fsprfx}list_version lv ON lv.version_id = t.product_version - WHERE t.task_id IN (23884, 22102) + WHERE t.task_id IN (21668, 22102, 23845, 23884) GROUP BY t.task_id, a.task_id "); $sth->execute(); my @result; while (my $row = $sth->fetchrow_hashref()) { - my $item = { + my $bug = { short_desc => $row->{item_summary}, product => $self->{map_project_id_to_name}->{$row->{project_id}}, component => $self->{map_component_id_to_name}->{$row->{product_category}} // $self->{map_component_id_to_name}->{-1}, @@ -313,15 +313,15 @@ sub _read_bugs { version => $row->{version_name} // "unspecified", comment => $row->{detailed_desc}, }; - $item->{version} = "unspecified" if $item->{version} eq "None"; - $item->{resolution} = "UNSPECIFIED" if $item->{resolution} eq "None"; - $item->{bug_status} = "RESOLVED" if $item->{resolution} ne ""; - $item->{component} = $self->{map_component_id_to_name}->{-1} if not defined $self->{project_id_components}->{$row->{project_id}}->{$item->{component}}; + $bug->{version} = "unspecified" if $bug->{version} eq "None"; + $bug->{resolution} = "UNSPECIFIED" if $bug->{resolution} eq "None"; + $bug->{bug_status} = "RESOLVED" if $bug->{resolution} ne ""; + $bug->{component} = $self->{map_component_id_to_name}->{-1} if not defined $self->{project_id_components}->{$row->{project_id}}->{$bug->{component}}; # handle initial comment/description - if (length($item->{comment}) > 65535) { - $item->{comment} = "--- The description has been moved to an attachment because it is longer than 65535 characters ---"; - unshift @{$item->{attachments}}, { + if (length($bug->{comment}) > 65535) { + $bug->{comment} = "--- The description has been moved to an attachment because it is longer than 65535 characters ---"; + unshift @{$bug->{attachments}}, { data => $row->{detailed_desc}, description => "Initial bug description", mimetype => "text/plain", @@ -342,7 +342,7 @@ sub _read_bugs { bug_when => $self->parse_date($comment->{date_added}), thetext => $comment->{comment_text}, }; - push @{$item->{comments}}, $comment_item; + push @{$bug->{comments}}, $comment_item; $comments->{$comment->{comment_id}} = $comment_item; } @@ -368,14 +368,14 @@ sub _read_bugs { # type 2 -> closed bug my $closure_comment = $history->{old_value}; if ($closure_comment ne "") { - push @{$item->{comments}}, { + push @{$bug->{comments}}, { who => $self->_get_username($history->{user_id}), bug_when => $self->parse_date($history->{event_date}), thetext => $closure_comment, }; } - push @{$item->{history}}, { + push @{$bug->{history}}, { who => $self->_get_username($history->{user_id}), bug_when => $self->parse_date($history->{event_date}), field => "resolution", @@ -385,7 +385,7 @@ sub _read_bugs { } elsif ($history->{event_type} == 3) { # type 3 -> field changed if ($history->{field_changed} eq "item_status") { - push @{$item->{history}}, { + push @{$bug->{history}}, { who => $self->_get_username($history->{user_id}), bug_when => $self->parse_date($history->{event_date}), field => "bug_status", @@ -408,7 +408,7 @@ sub _read_bugs { $attachments_sth->execute($row->{task_id}); my $attpath = $self->config("attachment_path"); while (my $attachment = $attachments_sth->fetchrow_hashref()) { - push @{$item->{attachments}}, { + push @{$bug->{attachments}}, { submitter => $self->_get_username($attachment->{added_by}), creation_ts => $attachment->{date_added}, description => $attachment->{file_desc} || $attachment->{orig_name}, @@ -422,7 +422,7 @@ sub _read_bugs { # change _insert_attachments/_insert_comments? } - push @result, $item; + push @result, $bug; } #$self->debug(\@result, 3); -- cgit v1.2.3-24-g4f1b