diff options
author | Florian Pritz <bluewind@xinu.at> | 2018-11-01 21:37:23 +0100 |
---|---|---|
committer | Florian Pritz <bluewind@xinu.at> | 2018-12-06 11:30:11 +0100 |
commit | fd5590bb10352cd6fde868ae1cdbfae339dd51e1 (patch) | |
tree | 85f180901346da51cd8c15f3d2c90dfa26662d48 /Bugzilla/Migrate | |
parent | bc7a9cfb1edcd4af6969a96403096ced89b527c9 (diff) | |
download | bugzilla-fd5590bb10352cd6fde868ae1cdbfae339dd51e1.tar.gz bugzilla-fd5590bb10352cd6fde868ae1cdbfae339dd51e1.tar.xz |
Flyspray: Only mark bugs as duplicates with the last dupe ID
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'Bugzilla/Migrate')
-rw-r--r-- | Bugzilla/Migrate/Flyspray.pm | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm index 527997361..ebcd9663b 100644 --- a/Bugzilla/Migrate/Flyspray.pm +++ b/Bugzilla/Migrate/Flyspray.pm @@ -485,13 +485,15 @@ sub _read_bugs { $self->translate_value('resolution', $bug->{resolution} // "") eq "DUPLICATE" and $closure_comment =~ m/FS#(\d+)/) { - push @{$self->{dupes}}, + push @{$self->{dupe_comments}}, { dupe_of => int($1), dupe => $row->{task_id}, who => $self->_get_username($history->{user_id}), bug_when => $self->parse_date($history->{event_date}), }; + $self->{dupe_mappings}->{$row->{task_id}} + = {dupe_of => int($1), dupe => $row->{task_id},}; } } } @@ -619,11 +621,14 @@ sub after_insert { my ($self) = @_; $self->debug("Marking duplicate bugs"); - for my $entry (@{$self->{dupes}}) { + for my $entry (values %{$self->{dupe_mappings}}) { my $dupeOf_bug = Bugzilla::Bug->new($entry->{dupe_of}); $self->{dbh}->do("INSERT INTO duplicates (dupe_of, dupe) VALUES (?, ?)", undef, $entry->{dupe_of}, $entry->{dupe}) unless defined $dupeOf_bug->{error}; + } + for my $entry (@{$self->{dupe_comments}}) { + my $dupeOf_bug = Bugzilla::Bug->new($entry->{dupe_of}); my $dupe_bug = Bugzilla::Bug->new($entry->{dupe}); |