]> git.donarmstrong.com Git - debbugs.git/commitdiff
Allow for tag nnn = baz + foo - bar in service (closes: #505189)
authorDon Armstrong <don@donarmstrong.com>
Tue, 30 Jun 2009 04:03:34 +0000 (21:03 -0700)
committerDon Armstrong <don@donarmstrong.com>
Tue, 30 Jun 2009 04:03:34 +0000 (21:03 -0700)
debian/changelog
scripts/service

index db2ec6bce34acbcbb98ad59fcd92e943a601f77f..971d13ef619c0dc9f556efdbc02a45b0addd7b7b 100644 (file)
@@ -250,6 +250,7 @@ debbugs (2.4.2~exp0) UNRELEASED; urgency=low
     (closes: #528249)
   * Properly html_escape un-processed parts in maybelink (closes: #530506)
   * Add urls to the bottom of all messages we send out (closes: #9596)
+  * Allow for tag nnn = baz + foo - bar in service (closes: #505189)
 
   
  -- Colin Watson <cjwatson@debian.org>  Fri, 20 Jun 2003 18:57:25 +0100
index 3756625fe1cdaf747a7df60737c0ba93f570adc0..ff738789e0741ccfa682d6a70d212e2b30100b0b 100755 (executable)
@@ -778,29 +778,48 @@ END
                print {$transcript} "Failed to set severity of $config{bug} $ref to $newseverity: ".cleanup_eval_fail($@,$debug)."\n";
            }
        }
-    } elsif (m/^tags?\s+\#?(-?\d+)\s+(([=+-])\s*)?(\S.*)?$/i) {
-       ### TODO: [#505189] Consider altering this to accept tag #nnn + foo - bar - baz
+    } elsif (m/^tags?\s+\#?(-?\d+)\s+(\S.*)$/i) {
        $ok++;
        $ref = $1;
        $ref = $clonebugs{$ref} if exists $clonebugs{$ref};
        $bug_affected{$ref}=1;
-       my $addsubcode = $3;
-       my @add_remove_option = ();
-       if (defined $addsubcode) {
-           if ($addsubcode eq '-') {
-               push @add_remove_option,(remove => 1);
-           }
-           elsif ($addsubcode eq '+') {
-               push @add_remove_option,(add => 1);
-           }
-       }
-       my $tags = $4;
+       my $tags = $2;
        my @tags = split /[\s,]+/, $tags;
-       my @badtags = ();
-       foreach my $tag (@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
+       # more obvious what is happening)
+       my @tag_operations = {tags => [],
+                             option => []
+                            };
+       my $alter_type = '=';
+       my @badtags;
+       for my $tag (@tags) {
+           if ($tag =~ /^[=+-]$/) {
+               if ($tag eq '=') {
+                   @tag_operations = {tags => [],
+                                      option => [],
+                                     };
+               }
+               elsif ($tag eq '-') {
+                   push @tag_operations,
+                       {tags => [],
+                        option => [remove => 1],
+                       };
+               }
+               elsif ($tag eq '+') {
+                   push @tag_operations,
+                       {tags => [],
+                        option => [add => 1]
+                       };
+               }
+               next;
+           }
            if (not defined first {$_ eq $tag} @{$config{tags}}) {
                push @badtags, $tag;
+               next;
            }
+           push @{$tag_operations[-1]{tags}},$tag;
        }
        if (@badtags) {
             print {$transcript} "Unknown tag/s: ".join(', ', @badtags).".\n".
@@ -808,13 +827,15 @@ END
            $errors++;
        }
        eval {
-           set_tags(@common_control_options,
-                    bug => $ref,
-                    tags => [@tags],
-                    warn_on_bad_tags => 0, # don't warn on bad tags,
-                                            # 'cause we do that above
-                    @add_remove_option,
-                   );
+           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}},
+                       );
+           }
        };
        if ($@) {
            # we intentionally have two errors here if there is a bad