From: Don Armstrong Date: Thu, 28 Jun 2007 02:44:55 +0000 (-0700) Subject: - Allow selecting the newest N bugs (closes: #84681) X-Git-Tag: release/2.6.0~529^2~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=bb03d6cc80d729e5984e4035a8fd714f4c7bdb75;p=debbugs.git - Allow selecting the newest N bugs (closes: #84681) --- diff --git a/Debbugs/Bugs.pm b/Debbugs/Bugs.pm index 010d671..e8d162e 100644 --- a/Debbugs/Bugs.pm +++ b/Debbugs/Bugs.pm @@ -290,7 +290,7 @@ sub newest_bug { my $next_number = <$nn_fh>; close $nn_fh; chomp $next_number; - return $next_number+0; + return $next_number-1; } =head2 bug_filter diff --git a/Debbugs/SOAP.pm b/Debbugs/SOAP.pm index cfe74bb..f9a4456 100644 --- a/Debbugs/SOAP.pm +++ b/Debbugs/SOAP.pm @@ -138,6 +138,22 @@ sub get_bugs{ return \@bugs; } +=head2 newest_bugs + + my @bugs = newest_bugs(5); + +Returns a list of the newest bugs. [Note that all bugs are *not* +guaranteed to exist, but they should in the most common cases.] + +=cut + +sub newest_bugs{ + my $VERSION = __populate_version(pop); + my ($self,$num) = @_; + my $newest_bug = Debbugs::bugs::newest_bug(); + @bugs = ($newest_bug - $num + 1) .. $newest_bug; +} + =head2 get_bug_log diff --git a/cgi/pkgreport.cgi b/cgi/pkgreport.cgi index eb33dc1..47a1099 100755 --- a/cgi/pkgreport.cgi +++ b/cgi/pkgreport.cgi @@ -20,7 +20,7 @@ use Debbugs::Config qw(:globals :text :config); use Debbugs::User; use Debbugs::CGI qw(version_url maint_decode); use Debbugs::Common qw(getparsedaddrs :date make_list getmaintainers); -use Debbugs::Bugs qw(get_bugs bug_filter); +use Debbugs::Bugs qw(get_bugs bug_filter newest_bug); use Debbugs::Packages qw(getsrcpkgs getpkgsrc get_versions); use Debbugs::Status qw(:status); use Debbugs::CGI qw(:all); @@ -41,7 +41,7 @@ our %param = cgi_parameters(query => $q, single => [qw(ordering archive repeatmerged), qw(bug-rev pend-rev sev-rev), qw(maxdays mindays version), - qw(data which dist), + qw(data which dist newest), ], default => {ordering => 'normal', archive => 0, @@ -165,7 +165,7 @@ our %cats = ( ); my @select_key = (qw(submitter maint pkg package src usertag), - qw(status tag maintenc owner severity) + qw(status tag maintenc owner severity newest) ); if (exists $param{which} and exists $param{data}) { @@ -316,7 +316,7 @@ while (my ($key,$value) = splice @search_key_order, 0, 2) { } push @title,$value.' '.join(' or ', @entries); } -my $title = join(' and ', map {/ or /?"($_)":$_} @title); +my $title = $gBugs.' '.join(' and ', map {/ or /?"($_)":$_} @title); @title = (); # we have to special case the maint="" search, unfortunatly. @@ -330,7 +330,12 @@ if (defined $param{maint} and $param{maint} eq "") { return 0; } ); - $title = 'in packages with no maintainer'; + $title = $gBugs.' in packages with no maintainer'; +} +elsif (defined $param{newest}) { + my $newest_bug = newest_bug(); + @bugs = ($newest_bug - $param{newest} + 1) .. $newest_bug; + $title = @bugs.' newest '.$gBugs; } else { #yeah for magick! @@ -368,7 +373,7 @@ print "\n" . "\n" . '' . "\n"; -print "

" . "$gProject$Archived $gBug report logs: $gBugs $title" . +print "

" . "$gProject$Archived $gBug report logs: $title" . "

\n"; my $showresult = 1; diff --git a/debian/changelog b/debian/changelog index d32fca6..42889f0 100644 --- a/debian/changelog +++ b/debian/changelog @@ -195,6 +195,7 @@ debbugs (2.4.2) UNRELEASED; urgency=low - Add bugspam.cgi with confirm string (closes: #348225) - Allow selecting both archived and unarchived bugs (closes: #320175) - Support intersecting sets of bugs (closes: #164421) + - Allow selecting the newest N bugs (closes: #84681) -- Colin Watson Fri, 20 Jun 2003 18:57:25 +0100