]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Search.pm
search: add help for patchid: prefix
[public-inbox.git] / lib / PublicInbox / Search.pm
index 145fb56ce75006d167efc541257aa05f37b5cd5f..b6141f684ebc61699d6fcf63fe80d2f47fbe15a8 100644 (file)
@@ -1,10 +1,11 @@
-# Copyright (C) 2015-2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 # based on notmuch, but with no concept of folders, files or flags
 #
 # Read-only search interface for use by the web and NNTP interfaces
 package PublicInbox::Search;
 use strict;
+use v5.10.1;
 use parent qw(Exporter);
 our @EXPORT_OK = qw(retry_reopen int_val get_pct xap_terms);
 use List::Util qw(max);
@@ -117,9 +118,10 @@ my %bool_pfx_external = (
        dfpre => 'XDFPRE',
        dfpost => 'XDFPOST',
        dfblob => 'XDFPRE XDFPOST',
+       patchid => 'XDFID',
 );
 
-my $non_quoted_body = 'XNQ XDFN XDFA XDFB XDFHH XDFCTX XDFPRE XDFPOST';
+my $non_quoted_body = 'XNQ XDFN XDFA XDFB XDFHH XDFCTX XDFPRE XDFPOST XDFID';
 my %prob_prefix = (
        # for mairix compatibility
        s => 'S',
@@ -154,9 +156,9 @@ my %prob_prefix = (
 our @HELP = (
        's:' => 'match within Subject  e.g. s:"a quick brown fox"',
        'd:' => <<EOF,
-match date range, git "approxidate" formats supported
-Open-ended ranges such as `d:last.week..' and `d:..2.days.ago'
-are supported
+match date-time range, git "approxidate" formats supported
+Open-ended ranges such as `d:last.week..' and
+`d:..2.days.ago' are supported
 EOF
        'b:' => 'match within message body, including text attachments',
        'nq:' => 'match non-quoted text within message body',
@@ -177,8 +179,9 @@ EOF
        'dfpre:' => 'match pre-image git blob ID',
        'dfpost:' => 'match post-image git blob ID',
        'dfblob:' => 'match either pre or post-image git blob ID',
+       'patchid:' => "match `git patch-id --stable' output",
        'rt:' => <<EOF,
-match received time, like `d:' unless sender's clock was broken
+match received time, like `d:' if sender's clock was correct
 EOF
 );
 chomp @HELP;
@@ -398,12 +401,10 @@ sub retry_reopen {
        my ($self, $cb, @arg) = @_;
        for my $i (1..10) {
                if (wantarray) {
-                       my @ret;
-                       eval { @ret = $cb->($self, @arg) };
+                       my @ret = eval { $cb->($self, @arg) };
                        return @ret unless $@;
                } else {
-                       my $ret;
-                       eval { $ret = $cb->($self, @arg) };
+                       my $ret = eval { $cb->($self, @arg) };
                        return $ret unless $@;
                }
                # Exception: The revision being read has been discarded -