From 4a1f2de954fb5486d7244e2bde288d38ab75e058 Mon Sep 17 00:00:00 2001 From: Don Armstrong Date: Fri, 15 Dec 2017 10:22:39 -0800 Subject: [PATCH] add skip-missing option --- bin/debbugs-spam | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/bin/debbugs-spam b/bin/debbugs-spam index b172e97e..164013bc 100755 --- a/bin/debbugs-spam +++ b/bin/debbugs-spam @@ -93,6 +93,7 @@ use Debbugs::Log qw(record_regex); use Debbugs::Log::Spam; use Debbugs::Config qw(:config); use Debbugs::Command qw(:all); +use Debbugs::Common qw(getbuglocation); use IPC::Open3 qw(open3); use Carp; @@ -119,8 +120,11 @@ handle_main_arguments(\%options, my %subcommands = ('auto-scan' => {function => \&auto_spamscan, arguments => {'ham_threshold|ham-threshold=s' => 0, + 'skip_missing|skip-missing!' => 0, }, - defaults => {ham_threshold => -5}, + defaults => {ham_threshold => -5, + skip_missing => 0, + }, }, 'score' => {function => \&score_bug, arguments => {'skip_seen|skip-seen!' => 0 @@ -226,6 +230,11 @@ sub auto_spamscan { my ($options,$opts,$config,$argv) = @_; for my $bug_num (@{$argv}) { + if ($opts->{skip_missing} and + not defined getbuglocation($bug_num,'log')) { + print STDERR "bug $bug_num does not exist\n" if $options->{verbose} > -1; + next; + } my $spam = Debbugs::Log::Spam->new(bug_num => $bug_num) or die "Unable to open bug log spam for $bug_num"; foreachmsg(sub { -- 2.39.5