From: Don Armstrong Date: Thu, 23 Jul 2009 16:35:42 +0000 (+0200) Subject: fix and add testing bits to test the issues with set_tag X-Git-Tag: release/2.6.0~460^2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=65d47ed0c094fb410a5e3003af56d9473892d37d;p=debbugs.git fix and add testing bits to test the issues with set_tag --- diff --git a/Debbugs/Control.pm b/Debbugs/Control.pm index 77785cea..136a6dc5 100644 --- a/Debbugs/Control.pm +++ b/Debbugs/Control.pm @@ -94,6 +94,7 @@ BEGIN{ fixed => [qw(set_found set_fixed)], package => [qw(set_package)], block => [qw(set_blocks)], + tag => [qw(set_tag)], archive => [qw(bug_archive bug_unarchive), ], log => [qw(append_action_to_log), @@ -614,7 +615,7 @@ sub set_tag { my %tag_added = (); my %tag_removed = (); my %fixed_removed = (); - my @old_tags = split /\,\s*/, $data->{tags}; + my @old_tags = split /\,\s*/, $data->{keywords}; my %tags; @tags{@old_tags} = (1) x @old_tags; my $reopened = 0; @@ -656,7 +657,7 @@ sub set_tag { print {$transcript} "Unknown tag(s): ".join(', ',@bad_tags).".\n"; print {$transcript} "These tags are recognized: ".join(', ',@{$config{tags}}).".\n"; } - $data->{tags} = join(', ',keys %tags); # double check this + $data->{keywords} = join(', ',keys %tags); # double check this my @changed; push @changed, 'added tag(s) '.english_join([keys %tag_added]) if keys %tag_added; diff --git a/scripts/service b/scripts/service index 3f05dc08..3c3e472a 100755 --- a/scripts/service +++ b/scripts/service @@ -787,11 +787,9 @@ END my @tags = split /[\s,]+/, $tags; # this is an array of hashrefs which contain two elements, the # first of which is the array of tags, the second is the - # option to pass to set_tags (we use a hashref here to make it + # option to pass to set_tag (we use a hashref here to make it # more obvious what is happening) - my @tag_operations = {tags => [], - option => [] - }; + my @tag_operations; my $alter_type = '='; my @badtags; for my $tag (@tags) { @@ -819,6 +817,11 @@ END push @badtags, $tag; next; } + if (not @tag_operations) { + @tag_operations = {tags => [], + option => [] + }; + } push @{$tag_operations[-1]{tags}},$tag; } if (@badtags) { @@ -828,13 +831,13 @@ END } eval { for my $operation (@tag_operations) { - set_tags(@common_control_options, - bug => $ref, - tags => [@{$operation->{$tags}}], - warn_on_bad_tags => 0, # don't warn on bad tags, - # 'cause we do that above - @{$operation->{option}}, - ); + set_tag(@common_control_options, + bug => $ref, + tag => [@{$operation->{tags}}], + warn_on_bad_tags => 0, # don't warn on bad tags, + # 'cause we do that above + @{$operation->{option}}, + ); } }; if ($@) { diff --git a/t/06_mail_handling.t b/t/06_mail_handling.t index 1c670942..0ae5d0af 100644 --- a/t/06_mail_handling.t +++ b/t/06_mail_handling.t @@ -1,7 +1,7 @@ # -*- mode: cperl;-*- # $Id: 05_mail.t,v 1.1 2005/08/17 21:46:17 don Exp $ -use Test::More tests => 102; +use Test::More tests => 111; use warnings; use strict; @@ -279,6 +279,21 @@ my @control_commands = status_key => 'owner', status_value => '', }, + tag => {command => 'tag', + value => ' = patch', + status_key => 'keywords', + status_value => 'patch', + }, + untag => {command => 'tag', + value => ' - patch', + status_key => 'keywords', + status_value => '', + }, + plustag => {command => 'tag', + value => ' + patch', + status_key => 'keywords', + status_value => 'patch', + }, ); # In order for the archive/unarchive to work, we have to munge the summary file slightly