summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2018-05-11 15:05:20 +0200
committerFlorian Pritz <bluewind@xinu.at>2018-12-06 11:08:18 +0100
commit11c87fb9cd98a247b2bf9b4c2e3961403e645b62 (patch)
tree09f509a847038c413d2ffc74a33c9bbe5131ab5a
parentcff72f3747c6809a2faa5d1bfd2edb21accd8421 (diff)
downloadbugzilla-11c87fb9cd98a247b2bf9b4c2e3961403e645b62.tar.gz
bugzilla-11c87fb9cd98a247b2bf9b4c2e3961403e645b62.tar.xz
Flyspray: Create comments for duplicate bugs
Signed-off-by: Florian Pritz <bluewind@xinu.at>
-rw-r--r--Bugzilla/Migrate/Flyspray.pm38
1 files changed, 32 insertions, 6 deletions
diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm
index aa3346bb6..bed3d3305 100644
--- a/Bugzilla/Migrate/Flyspray.pm
+++ b/Bugzilla/Migrate/Flyspray.pm
@@ -435,7 +435,30 @@ sub _read_bugs {
$self->translate_value('resolution', $bug->{resolution} // "") eq "DUPLICATE"
and $closure_comment =~ m/FS#(\d+)/)
{
- $self->{dupes}->{$row->{task_id}} = int($1);
+ push @{$self->{dupes}},
+ {
+ dupe_of => int($1),
+ dupe => $row->{task_id},
+ who => $self->_get_username($history->{user_id}),
+ bug_when => $self->parse_date($history->{event_date}),
+ };
+
+ push @{$bug->{comments}},
+ {
+ type => CMT_DUPE_OF,
+ extra_data => int($1),
+ who => $self->_get_username($history->{user_id}),
+ bug_when => $self->parse_date($history->{event_date}),
+ };
+
+ push @{$self->{bug_map}->{int($1)}->{comments}},
+ {
+ type => CMT_HAS_DUPE,
+ extra_data => $row->{task_id},
+ who => $self->_get_username($history->{user_id}),
+ bug_when => $self->parse_date($history->{event_date}),
+ }
+ if defined $self->{bug_map}->{int($1)};
}
}
}
@@ -495,6 +518,8 @@ sub _read_bugs {
#die if $attachment->{date_added} == 1110715864;
}
+ $self->{bug_map}->{$bug->{bug_id}} = $bug;
+
push @result, $bug;
}
@@ -565,12 +590,13 @@ sub after_read {
sub after_insert {
my ($self) = @_;
- for my $dupe (keys %{$self->{dupes}}) {
- my $dupe_of = $self->{dupes}->{$dupe};
- my $bug = Bugzilla::Bug->new($dupe_of);
+ $self->debug("Marking duplicate bugs");
+ $self->debug($self->{dupes}, 3);
+ for my $entry (@{$self->{dupes}}) {
+ my $dupeOf_bug = Bugzilla::Bug->new($entry->{dupe_of});
$self->{dbh}->do("INSERT INTO duplicates (dupe_of, dupe) VALUES (?, ?)",
- undef, $dupe_of, $dupe)
- unless defined $bug->{error};
+ undef, $entry->{dupe_of}, $entry->{dupe})
+ unless defined $dupeOf_bug->{error};
}
}