summaryrefslogtreecommitdiffstats
path: root/contrib/convert-workflow.pl
diff options
context:
space:
mode:
authorMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-06 20:03:40 +0200
committerMax Kanat-Alexander <mkanat@bugzilla.org>2010-07-06 20:03:40 +0200
commit6f274b8a04a1954e12b173427f674856679b9551 (patch)
tree4a518e35f9d65004ef320614c4c814f868ee422c /contrib/convert-workflow.pl
parentb0b2c0987dfd8226bb1a34c435a7a208190165ab (diff)
downloadbugzilla-6f274b8a04a1954e12b173427f674856679b9551.tar.gz
bugzilla-6f274b8a04a1954e12b173427f674856679b9551.tar.xz
Bug 577037: Make convert-workflow convert statuses in order, so that
IN_PROGRESS doesn't end up before CONFIRMED. r=LpSolit, a=LpSolit
Diffstat (limited to 'contrib/convert-workflow.pl')
-rwxr-xr-xcontrib/convert-workflow.pl17
1 files changed, 11 insertions, 6 deletions
diff --git a/contrib/convert-workflow.pl b/contrib/convert-workflow.pl
index c01b751c0..7525bac95 100755
--- a/contrib/convert-workflow.pl
+++ b/contrib/convert-workflow.pl
@@ -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);