Author: jamessan
Date: 2009-12-31 21:11:49 +0000 (Thu, 31 Dec 2009)
New Revision: 2061
Modified:
trunk/debian/changelog
trunk/scripts/bts.pl
Log:
* bts:
+ Allow specifying which fields will be shown by "bts status". (Closes:
#499283)
+ Add "verbose" option to "bts status", which will also show fields that
don't have a set value.
Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog 2009-12-31 20:33:56 UTC (rev 2060)
+++ trunk/debian/changelog 2009-12-31 21:11:49 UTC (rev 2061)
@@ -11,8 +11,13 @@
+ Add missing verb in description of FTP syntax. Thanks to Marco TĂșlio
Gontijo for the patch. (Closes: #562586)
* annotate-output: Allow specifying a timestamp format. (Closes: #539720)
- * bts: Always include "thanks" at the end of the control block. (Closes:
- #542962)
+ * bts:
+ + Always include "thanks" at the end of the control block. (Closes:
+ #542962)
+ + Allow specifying which fields will be shown by "bts status". (Closes:
+ #499283)
+ + Add "verbose" option to "bts status", which will also show fields that
+ don't have a set value.
[ Patrick Schoenfeld ]
* licensecheck: Add support for some common variants of the WTFPL
Modified: trunk/scripts/bts.pl
===================================================================
--- trunk/scripts/bts.pl 2009-12-31 20:33:56 UTC (rev 2060)
+++ trunk/scripts/bts.pl 2009-12-31 21:11:49 UTC (rev 2061)
@@ -1050,24 +1050,31 @@
print map {qq($_\n)} @{$bugs};
}
-=item status [<bug> | file:<file>] ...
+=item status [<bug> | file:<file> | fields:<field,field,...> | verbose] ...
Uses the SOAP interface to output status information for the given bugs
(or as read from the listed files -- use '-' to indicate STDIN).
-Empty status fields are not displayed.
+By default, all populated fields for a bug are displayed.
+If B<verbose> is given, empty fields will also be displayed.
+
+If B<fields> is given, only those fields will be displayed. No validity
+checking is performed on any specified fields.
+
=cut
sub bts_status {
my @args = @_;
my @bugs;
+ my $showempty = 0;
+ my %field;
for my $bug (@args) {
if (looks_like_number($bug)) {
push @bugs,$bug;
}
- elsif (m{^file:(.+)}) {
+ elsif ($bug =~ m{^file:(.+)}) {
my $file = $1;
my $fh;
if ($file eq '-') {
@@ -1085,6 +1092,16 @@
push @bugs,$_;
}
}
+ elsif ($bug =~ m{^fields:(.+)}) {
+ my $fields = $1;
+ for my $field (split /,/, $fields) {
+ $field{lc $field} = 1;
+ }
+ $showempty = 1;
+ }
+ elsif ($bug =~ m{^verbose$}) {
+ $showempty = 1;
+ }
}
my $bugs = Devscripts::Debbugs::status( map {[bug => $_, indicatesource =>
1]} @bugs );
return if ($bugs eq "");
@@ -1096,6 +1113,9 @@
my @keys = grep {$_ ne 'bug_num'}
keys %{$bugs->{$bug}};
for my $key ('bug_num',@keys) {
+ if (%field) {
+ next unless exists $field{$key};
+ }
my $out;
if (ref($bugs->{$bug}{$key}) eq 'ARRAY') {
$out .= join(',',@{$bugs->{$bug}{$key}});
@@ -1109,7 +1129,9 @@
else {
$out .= $bugs->{$bug}{$key}||'';
}
- print "$key\t$out\n" if $out;
+ if ($out || $showempty) {
+ print "$key\t$out\n";
+ }
}
}
}
--
To unsubscribe, send mail to [email protected].