On 08/24/2016 11:34 AM, Johannes Schindelin wrote:
> Hi Arif,

Hello Johannes,

> On Tue, 23 Aug 2016, Arif Khokar wrote:
>
>> Given that public-inbox provides an NNTP interface, couldn't the ARTICLE
>> <message-id> NNTP command be used to easily retrieve the messages in a
>> given patch series (at least compared to POP or IMAP).  Perhaps
>> git-send-email could be modified to include the message-id value of each
>> patch in the series that it sends to the mailing list and include it in
>> the cover letter.
>
> I am no expert in the NNTP protocol (I abandoned News long ago), but if
> you go from HTML, you can automate the process without requiring changes
> in format-patch.

Could you elaborate further on what you mean by using HTML in this context?

> I recently adapted an old script I had to apply an entire patch series
> given the GMane link to its cover letter:
>
> https://github.com/git-for-windows/build-extra/blob/master/apply-from-gmane.sh
>
> Maybe you find it in you to adapt that to work with public-inbox.org?

I was thinking more along the lines of using NNTP to retrieve the 
patches and save them to disk (rather than HTTP).  For example, a perl 
script like the following could retrieve the article directly over NNTP. 
  I haven't tested whether the resulting file would work with git-am 
though (since it may not meet the criteria of a mbox file).

You can invoke it as follows:

> perl download_patch.pl 
> "<520a941f7472ac1cb4fa41e6bba33a0afc2f5999.1471264971.git.johannes.schinde...@gmx.de>"


* Forgive any formatting issues resulting from my use of Thunderbird as 
a MUA.

use strict;
use warnings;

use Net::NNTP;

# Assume $ARGV[0] is the message id
my $message_id = $ARGV[0];

my $gmane_nntp = Net::NNTP->new('news.gmane.org');
my $article_ref = $gmane_nntp->article($message_id);

# Make a filename like git-format-patch would
my $counter = 1;
my $subject_line = (grep /^Subject: /, @$article_ref)[0];
$subject_line =~ s/^Subject:[^]]+] //;
$subject_line =~ s/ /-/g;
my $filename = sprintf "%04i-%s", $counter, $subject_line;

print "Filename:\n";
print $filename;
print "\n";

print "Article\n";
my $article_str = join "", @$article_ref;

print $article_str;

Reply via email to