From a6c9e2924be38fdae644bc9bba34f5cbd33d6348 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Tue, 2 Jan 2018 14:55:07 +0100 Subject: WIP: misc Signed-off-by: Florian Pritz --- Bugzilla/Migrate/Flyspray.pm | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm index 701a71a94..8116392a9 100644 --- a/Bugzilla/Migrate/Flyspray.pm +++ b/Bugzilla/Migrate/Flyspray.pm @@ -51,13 +51,6 @@ use constant FIELD_MAP => { }; use constant VALUE_MAP => { - bug_severity => { - 'critical' => 'critical', - 'high' => 'high', - 'medium' => 'medium', - 'low' => 'low', - 'very low' => 'very low', - }, bug_status => { 'unconfirmed' => 'NEW', 'new' => 'NEW', @@ -79,13 +72,22 @@ use constant VALUE_MAP => { 'fixed' => 'FIXED', 'implemented' => 'FIXED', }, + priority => { + 0 => "--", + 1 => "Low", + 2 => "Normal", + 3 => "High", + 4 => "Highest", + 5 => "Immediate", + 6 => "Flash", + }, bug_severity => { - 'Flash' => 'Flash', - 'Immediate' => 'Immediate', - 'Urgent' => 'Urgent', - 'High' => 'High', - 'Normal' => 'Normal', - 'Low' => 'Low', + 0 => "--", + 1 => "enhancement", + 2 => "minor", + 3 => "normal", + 4 => "major", + 5 => "blocker", }, }; @@ -275,6 +277,7 @@ sub _read_bugs { t.detailed_desc, t.opened_by, t.task_priority, + t.task_severity, t.item_status, t.date_opened, t.last_edited_time, @@ -307,7 +310,8 @@ sub _read_bugs { op_sys => "Linux", rep_platform => "PC", bug_status => $row->{status_name} // "Unknown", - bug_severity => $row->{task_priority}, + bug_severity => $row->{task_severity}, + priority => $row->{task_priority}, resolution => $row->{is_closed} ? $row->{resolution_name} // 'UNKNOWN' : '', reporter => $self->_get_username($row->{opened_by}), creation_ts => $row->{date_opened}, @@ -324,6 +328,7 @@ sub _read_bugs { 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}}, { + submitter => $bug->{reporter}, data => $row->{detailed_desc}, description => "Initial bug description", mimetype => "text/plain", @@ -498,7 +503,9 @@ sub after_insert { my ($self) = @_; for my $dupe (keys %{$self->{dupes}}) { - $self->{dbh}->do("INSERT INTO duplicates (dupe_of, dupe) VALUES (?, ?)", undef, $self->{dupes}->{$dupe}, $$dupe); + my $dupe_of = $self->{dupes}->{$dupe}; + my $bug = Bugzilla::Bug->new($dupe_of); + $self->{dbh}->do("INSERT INTO duplicates (dupe_of, dupe) VALUES (?, ?)", undef, $dupe_of, $dupe) unless defined $bug->{error}; } } -- cgit v1.2.3-24-g4f1b