From: Kyle Meyer <kyle@kyleam.com>
To: Eric Wong <e@80x24.org>
Cc: meta@public-inbox.org
Subject: Re: [PATCH 1/3] lei p2q: patch-to-query generator for "lei q --stdin"
Date: Sun, 28 Feb 2021 16:40:21 -0500 [thread overview]
Message-ID: <87k0qrrhve.fsf@kyleam.com> (raw)
In-Reply-To: <20210228122528.18552-2-e@80x24.org>
Eric Wong writes:
> Instead of teaching the to-be-implemented "lei show" to search
> threads/messages based commits, this orthogonal sub-command is
> designed to generate queries for use with "lei q --stdin".
>
> URI-escaped query parameters may be generated with --uri for
> HTTP(S) public-inbox instances, but otherwise the output is
> designed for "lei q --stdin".
>
> To find threads for a given git commit from a git worktree:
>
> lei p2q $COMMIT_OID | lei q --stdin -t ...
>
> It can also read via --stdin|-
>
> curl $INBOX_URL/$MSGID/raw | lei p2q - | lei q --stdin -t
>
> Or from the filesystem:
>
> lei p2q $(git format-patch -1) | lei q --stdin -t
Very nice :)
> diff --git a/lib/PublicInbox/LeiP2q.pm b/lib/PublicInbox/LeiP2q.pm
[...]
> + } elsif (m!^(?:---|\+{3}) ("?[^/]+/.+)!) {
> + my $fn = (split(m!/!, git_unquote($1.''), 2))[1];
> + push @{$lei->{qterms}->{dfn}}, xphrase($fn);
> + } elsif ($in_diff && s/^\+//) { # diff added
> + push @{$lei->{qterms}->{dfb}}, xphrase($_);
> + } elsif ($in_diff && s/^-//) { # diff removed
> + push @{$lei->{qterms}->{dfa}}, xphrase($_);
I noticed an unexpected term when trying dfa:
$ curl -fSs \
https://public-inbox.org/meta/20210228122528.18552-2-e@80x24.org/raw >msg
$ lei p2q --want=dfa msg
dfa:my @WQ_KEYS = qw dfa:"lxs l2m imp mrr cnv" dfa:"internal workers" dfa:dev/null
So I think the upstream "--- " filename regexp needs to be adjusted to
account for "/dev/null".
next prev parent reply other threads:[~2021-02-28 21:40 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-28 12:25 [PATCH 0/3] lei p2q (patch-to-query) Eric Wong
2021-02-28 12:25 ` [PATCH 1/3] lei p2q: patch-to-query generator for "lei q --stdin" Eric Wong
2021-02-28 21:40 ` Kyle Meyer [this message]
2021-03-01 5:47 ` [PATCH 4/3] lei p2q: fix /dev/null filenames, fix phrase quoting rules Eric Wong
2021-02-28 12:25 ` [PATCH 2/3] lei q: fix "-" shortcut for --stdin Eric Wong
2021-02-28 12:25 ` [PATCH 3/3] lei q: improve early aborts w/ remote externals Eric Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://public-inbox.org/README
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87k0qrrhve.fsf@kyleam.com \
--to=kyle@kyleam.com \
--cc=e@80x24.org \
--cc=meta@public-inbox.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).