]> git.donarmstrong.com Git - debbugs.git/commitdiff
* Allow archive=>both in get_bugs() to search both archived and
authorDon Armstrong <don@donarmstrong.com>
Sun, 17 Jun 2007 09:54:08 +0000 (10:54 +0100)
committerDon Armstrong <don@donarmstrong.com>
Sun, 17 Jun 2007 09:54:08 +0000 (10:54 +0100)
   unarchived bugs

Debbugs/Bugs.pm

index 2399102d5e496cc2fed72e84a4483eee6b825904..bb793134b87dff9dd00f109a021689fce5d7f010 100644 (file)
@@ -104,7 +104,8 @@ searches are performed.
 =over
 
 =item archive -- whether to search archived bugs or normal bugs;
-defaults to false.
+defaults to false. As a special case, if archive is 'both', but
+archived and unarchived bugs are returned.
 
 =item usertags -- set of usertags and the bugs they are applied to
 
@@ -180,7 +181,7 @@ sub get_bugs{
                                          bugs      => {type => SCALAR|ARRAYREF,
                                                        optional => 1,
                                                       },
-                                         archive   => {type => BOOLEAN,
+                                         archive   => {type => BOOLEAN|SCALAR,
                                                        default => 0,
                                                       },
                                          usertags  => {type => HASHREF,
@@ -192,6 +193,13 @@ sub get_bugs{
      # Normalize options
      my %options = %param;
      my @bugs;
+     if ($options{archive} eq 'both') {
+         push @bugs, get_bugs(%options,archive=>0);
+         push @bugs, get_bugs(%options,archive=>1);
+         my %bugs;
+         @bugs{@bugs} = @bugs;
+         return keys %bugs;
+     }
      # A configuration option will set an array that we'll use here instead.
      for my $routine (qw(Debbugs::Bugs::get_bugs_by_idx Debbugs::Bugs::get_bugs_flatfile)) {
          my ($package) = $routine =~ m/^(.+)\:\:/;