Fire up a mail user agent to follow up to a given bug report, quoting the bug
log text. Per default the text of the first message in the bug log is inlined
for quoting purposes, you can specify an alternative one providing an optional
-bug log ID. The first message in the bug log has bug log ID 0, second message
-1, and so on.
+bug log ID. The first message in the bug log has bug log ID 1, second message
+2, and so on. Alternatively, "last" can be specified as a bug log ID to choose
+the last message, "last-1" to choose the next to last, and so on.
=cut
$msglogid = 1 unless defined $msglogid;
my $soap = SOAP::Lite->uri($soapurl)->proxy($soapproxyurl);
my $log = $soap->get_bug_log($bug)->result();
- my $msg = $log->[$msglogid-1];
+ my @logs = @$log;
+ my $msg;
+ if ($msglogid =~ /^last(-(\d+))?$/i) {
+ my $idx = defined $2 ? $#logs-$2 : $#logs;
+ $msg = $logs[$idx];
+ } else {
+ $msg = $logs[$msglogid-1];
+ }
my %headers = parse_rfc822_headers($msg->{header});
# extract data needed to compose the follow up email
--- /usr/bin/bts 2008-01-11 21:59:45.000000000 +0100
-+++ bts 2008-01-26 16:04:34.000000000 +0100
++++ bts 2008-01-27 20:38:48.000000000 +0100
@@ -266,6 +266,13 @@
shell. Default is 'mutt -f %s'. (Also, %% will be substituted by a
single % if this is needed.)
if ($opt_sendmail and $opt_smtphost) {
die "bts: --sendmail and --smtp-host mutually exclusive\n";
}
-@@ -901,6 +920,69 @@
+@@ -901,6 +920,77 @@
print map {qq($_\n)} @{$bugs};
}
+Fire up a mail user agent to follow up to a given bug report, quoting the bug
+log text. Per default the text of the first message in the bug log is inlined
+for quoting purposes, you can specify an alternative one providing an optional
-+bug log ID. The first message in the bug log has bug log ID 0, second message
-+1, and so on.
++bug log ID. The first message in the bug log has bug log ID 1, second message
++2, and so on. Alternatively, "last" can be specified as a bug log ID to choose
++the last message, "last-1" to choose the next to last, and so on.
+
+=cut
+
+ $msglogid = 1 unless defined $msglogid;
+ my $soap = SOAP::Lite->uri($soapurl)->proxy($soapproxyurl);
+ my $log = $soap->get_bug_log($bug)->result();
-+ my $msg = $log->[$msglogid-1];
++ my @logs = @$log;
++ my $msg;
++ if ($msglogid =~ /^last(-(\d+))?$/i) {
++ my $idx = defined $2 ? $#logs-$2 : $#logs;
++ $msg = $logs[$idx];
++ } else {
++ $msg = $logs[$msglogid-1];
++ }
+ my %headers = parse_rfc822_headers($msg->{header});
+
+ # extract data needed to compose the follow up email
=item clone <bug> [new IDs]
The clone control command allows you to duplicate a bug report. It is useful
-@@ -2194,6 +2276,24 @@
+@@ -2194,6 +2284,24 @@
return $header;
}
########## Browsing and caching subroutines
# Mirrors a given thing; if the online version is no newer than our
-@@ -3217,6 +3317,11 @@
+@@ -3217,6 +3325,11 @@
If this is set, specifies a mail reader to use instead of mutt. Same as
the --mailreader command line option.