From ba4585ae8a1c63a49e40461d2e2efc12bc75c58a Mon Sep 17 00:00:00 2001 From: Max Kanat-Alexander Date: Mon, 5 Jul 2010 17:42:57 -0700 Subject: Bug 486292: Change the default workflow to UNCONFIRMED, CONFIRMED, IN_PROGRESS, RESOLVED, VERIFIED. r=LpSolit, a=mkanat --- contrib/bugzilla-submit/bugzilla-submit | 2 +- contrib/convert-workflow.pl | 111 ++++++++++++++++++++++++++++++++ contrib/jb2bz.py | 8 +-- 3 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 contrib/convert-workflow.pl (limited to 'contrib') diff --git a/contrib/bugzilla-submit/bugzilla-submit b/contrib/bugzilla-submit/bugzilla-submit index e1e9b64d8..d98e7de8d 100755 --- a/contrib/bugzilla-submit/bugzilla-submit +++ b/contrib/bugzilla-submit/bugzilla-submit @@ -152,7 +152,7 @@ def ensure_defaults(data): if 'rep_platform' not in data: data['rep_platform'] = 'PC' if 'bug_status' not in data: - data['bug_status'] = 'NEW' + data['bug_status'] = 'CONFIRMED' if 'bug_severity' not in data: data['bug_severity'] = 'normal' if 'bug_file_loc' not in data: diff --git a/contrib/convert-workflow.pl b/contrib/convert-workflow.pl new file mode 100644 index 000000000..c01b751c0 --- /dev/null +++ b/contrib/convert-workflow.pl @@ -0,0 +1,111 @@ +#!/usr/bin/perl -w +# +# The contents of this file are subject to the Mozilla Public +# License Version 1.1 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS +# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or +# implied. See the License for the specific language governing +# rights and limitations under the License. +# +# The Original Code is the Bugzilla Bug Tracking System. +# +# The Initial Developer of the Original Code is Everything Solved, Inc. +# Portions created by the Initial Developer are Copyright (C) 2009 the +# Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Max Kanat-Alexander + +use strict; +use warnings; +use lib qw(. lib); + +use Bugzilla; +use Bugzilla::Config qw(:admin); +use Bugzilla::Status; + +my $confirmed = new Bugzilla::Status({ name => 'CONFIRMED' }); +my $in_progress = new Bugzilla::Status({ name => 'IN_PROGRESS' }); + +if ($confirmed and $in_progress) { + print "You are already using the new workflow.\n"; + exit 1; +} + +print <dbh; +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) { + print "Converting $from to $to...\n"; + $dbh->do('UPDATE bugs SET bug_status = ? WHERE bug_status = ?', + undef, $to, $from); + + if (Bugzilla->params->{'duplicate_or_move_bug_status'} eq $from) { + SetParam('duplicate_or_move_bug_status', $to); + write_params(); + } + + foreach my $what (qw(added removed)) { + $dbh->do("UPDATE bugs_activity SET $what = ? + WHERE fieldid = ? AND $what = ?", + undef, $to, $status_field->id, $from); + } + + # Delete any transitions where it now appears that + # a bug moved from a status to itself. + $dbh->do('DELETE FROM bugs_activity WHERE fieldid = ? AND added = removed', + undef, $status_field->id); + + # If the new status already exists, just delete the old one, but retain + # the workflow items from it. + if (my $existing = new Bugzilla::Status({ name => $to })) { + $dbh->do('DELETE FROM bug_status WHERE value = ?', undef, $from); + } + # Otherwise, rename the old status to the new one. + else { + $dbh->do('UPDATE bug_status SET value = ? WHERE value = ?', + undef, $to, $from); + } +} + +$dbh->bz_commit_transaction(); + +print <