]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 577037: Make convert-workflow convert statuses in order, so that
authorMax Kanat-Alexander <mkanat@bugzilla.org>
Tue, 6 Jul 2010 18:03:40 +0000 (11:03 -0700)
committerMax Kanat-Alexander <mkanat@bugzilla.org>
Tue, 6 Jul 2010 18:03:40 +0000 (11:03 -0700)
IN_PROGRESS doesn't end up before CONFIRMED.
r=LpSolit, a=LpSolit

contrib/convert-workflow.pl

index c01b751c099d31aa5990de1963b5e001b906d351..7525bac959dab0c889bbf9acc42c8da53edb3612 100755 (executable)
@@ -54,16 +54,21 @@ END
 getc;
 
 my $dbh = Bugzilla->dbh;
-my %translation = (
-    NEW      => 'CONFIRMED',
-    ASSIGNED => 'IN_PROGRESS',
-    REOPENED => 'CONFIRMED',
-    CLOSED   => 'VERIFIED',
+# This is an array instead of a hash so that we can be sure that
+# the translation happens in the right order. In particular, we
+# want NEW to be renamed to CONFIRMED, instead of having REOPENED
+# be the one that gets renamed.
+my @translation = (
+    [NEW      => 'CONFIRMED'],
+    [ASSIGNED => 'IN_PROGRESS'],
+    [REOPENED => 'CONFIRMED'],
+    [CLOSED   => 'VERIFIED'],
 );
 
 my $status_field = Bugzilla::Field->check('bug_status');
 $dbh->bz_start_transaction();
-while (my ($from, $to) = each %translation) {
+foreach my $pair (@translation) {
+    my ($from, $to) = @$pair;
     print "Converting $from to $to...\n";
     $dbh->do('UPDATE bugs SET bug_status = ? WHERE bug_status = ?',
              undef, $to, $from);