From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-3.4 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from out2.migadu.com (out2.migadu.com [188.165.223.204]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id C06C91F9FE for ; Sun, 28 Feb 2021 21:40:29 +0000 (UTC) X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kyleam.com; s=key1; t=1614548427; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ILHRH05JUDkBljCHhavGubieDYegfhN8kZ9V1lZeHhA=; b=asjs5HKGQbm6yfUF3jVrz3nydQG81hzq4QfYUstymxvBqiKshEZxPif839rhlUoXXWrqCJ uQx31nTPMt0s+EmNHoiBGDTn33jMhkJlZOV1uohtnc1p8FAreVrWnp8A3LSsCbn3xWagEA otqDZzuEAQ+wqdZ1ODJWXnh0CEkIgiDGehRX+T//O2A3lh/rZUTKRrSRsRdia6k+inOpU8 z2JLrlxQFceSBSMLhh3zP3enEZKdSSp6OuH6SvnPouIfQ/E+vUry4BOfx1FMGtAcvIPAxF b1fG4ou6+92yAICMlx274z+bfEhDv9sPbBIjbQXr4V/ry3OSHjB7e1aOR/Zmnw== From: Kyle Meyer To: Eric Wong Cc: meta@public-inbox.org Subject: Re: [PATCH 1/3] lei p2q: patch-to-query generator for "lei q --stdin" In-Reply-To: <20210228122528.18552-2-e@80x24.org> References: <20210228122528.18552-1-e@80x24.org> <20210228122528.18552-2-e@80x24.org> Date: Sun, 28 Feb 2021 16:40:21 -0500 Message-ID: <87k0qrrhve.fsf@kyleam.com> MIME-Version: 1.0 Content-Type: text/plain X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: kyle@kyleam.com List-Id: 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".