From d67d9fd215186016ce370cd8fedc0ec891a081d1 Mon Sep 17 00:00:00 2001 From: Florian Pritz Date: Wed, 27 Dec 2017 15:43:12 +0100 Subject: WIP: Migrate duplicate ID Signed-off-by: Florian Pritz --- Bugzilla/Migrate.pm | 4 ++++ Bugzilla/Migrate/Flyspray.pm | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/Bugzilla/Migrate.pm b/Bugzilla/Migrate.pm index 5058bc6f7..1aedbe39f 100644 --- a/Bugzilla/Migrate.pm +++ b/Bugzilla/Migrate.pm @@ -716,6 +716,7 @@ sub insert_bugs { my $comments = delete $bug->{comments}; my $history = delete $bug->{history}; my $attachments = delete $bug->{attachments}; + my $dup_id = delete $bug->{dup_id}; $self->debug($bug, 3); @@ -776,6 +777,9 @@ sub insert_bugs { $reporter->{groups} = $super_user->groups; Bugzilla->set_user($reporter); my $created = Bugzilla::Bug->create($bug); + if (defined $dup_id) { + $dbh->do("INSERT INTO duplicates (dupe_of, dupe) VALUES (?, ?)", undef, $dup_id, $created->id); + } $self->debug('Created bug ' . $created->id); Bugzilla->set_user($super_user); diff --git a/Bugzilla/Migrate/Flyspray.pm b/Bugzilla/Migrate/Flyspray.pm index 9d8949919..024b99b4b 100644 --- a/Bugzilla/Migrate/Flyspray.pm +++ b/Bugzilla/Migrate/Flyspray.pm @@ -382,6 +382,11 @@ sub _read_bugs { removed => "", added => $history->{resolution_name}, }; + if ($self->translate_value('resolution', $history->{resolution_name}) eq "DUPLICATE") { + if ($closure_comment =~ m/FS#(\d+)/) { + $bug->{dup_id} = int($1); + } + } } elsif ($history->{event_type} == 3) { # type 3 -> field changed if ($history->{field_changed} eq "item_status") { -- cgit v1.2.3-24-g4f1b