]> git.donarmstrong.com Git - debbugs.git/commitdiff
fix and add testing bits to test the issues with set_tag
authorDon Armstrong <don@donarmstrong.com>
Thu, 23 Jul 2009 16:35:42 +0000 (18:35 +0200)
committerDon Armstrong <don@donarmstrong.com>
Thu, 23 Jul 2009 16:35:42 +0000 (18:35 +0200)
Debbugs/Control.pm
scripts/service
t/06_mail_handling.t

index 77785ceaeced06d9abf0855b1f5b967a6c0af8da..136a6dc54462719e67641361dcd961889463f764 100644 (file)
@@ -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;
index 3f05dc082e3fe3b82acb28de4fb8e9b2246ccaf7..3c3e472af03516c13a6a2da7381b8ee5302fc43b 100755 (executable)
@@ -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 ($@) {
index 1c6709420d8af4644d5c100777d5ddb2f643ee6f..0ae5d0afac26ff1ebea92fcf79f6f463df8afdb0 100644 (file)
@@ -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