From 60d8b93c0017253f11bbea0108e0a25e371e4a9b 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 | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm index 84dc247ca..38a450b36 100644 --- a/Bugzilla/Migrate/Flyspray.pm +++ b/Bugzilla/Migrate/Flyspray.pm @@ -305,14 +305,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}} @@ -333,18 +333,18 @@ 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} + $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}} - ->{$item->{component}}; + ->{$bug->{component}}; # handle initial comment/description - if (length($item->{comment}) > 65535) { - $item->{comment} + if (length($bug->{comment}) > 65535) { + $bug->{comment} = "--- The description has been moved to an attachment because it is longer than 65535 characters ---"; - unshift @{$item->{attachments}}, + unshift @{$bug->{attachments}}, { data => $row->{detailed_desc}, description => "Initial bug description", @@ -367,7 +367,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; } @@ -394,7 +394,7 @@ 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}), @@ -402,7 +402,7 @@ sub _read_bugs { }; } - push @{$item->{history}}, + push @{$bug->{history}}, { who => $self->_get_username($history->{user_id}), bug_when => $self->parse_date($history->{event_date}), @@ -415,7 +415,7 @@ sub _read_bugs { # 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}), @@ -441,7 +441,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}, @@ -457,7 +457,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