Re: Changelogs on kernel.org

Tomas Szepe
2002-05-12T22:12:18Z

> [Marcus Alanen <marcus@infa.abo.fi>, May-13 2002, Mon, 00:42 +0300]
> In mailing-lists.linux-kernel, you wrote:
> >torvalds@transmeta.com (Linus Torvalds) writes:
> >
> >> Perl is the obvious choice for doing transformations like these. Is
> >> anybody willing to write a perl script that does the "sort by author"
> >> thing?
>
> [snip]
> Basically the same, this treats each patch separately:

I took the liberty of kicking it up another notch :)

- allow whitespace at the beginning of email line (strip it, though)

- remove whitespace at the beginning and the end of "content"
lines and print everything out with a single tab in front

T.

Will process horrible mess like:
--
<jsimmons@heisenberg.transvirtual.com> asfd
A bunch of fixes.

<jsimmons@heisenberg.transvirtual.com>
Pmac updates

<jsimmons@heisenberg.transvirtual.com> mmmm
Some more small fixes.

<rmk@arm.linux.org.uk>
[PATCH] 2.5.13: vmalloc link failure

The following patch fixes this, and also fixes the similar problem in
scsi_debug.c:

<trond.myklebust@fys.uio.no>
[PATCH] in_ntoa link failure

Nothing serious. Whoever it was that did that global replacemissed a
spot is all...

<viro@math.psu.edu>
[PATCH] change_floppy() fix

Needed both in 2.4 and 2.5

-- into: --

<jsimmons@heisenberg.transvirtual.com>
--------------------------------------------------------------
A bunch of fixes.

--------------------------------------------------------------
Pmac updates

--------------------------------------------------------------
Some more small fixes.

<rmk@arm.linux.org.uk>
--------------------------------------------------------------
[PATCH] 2.5.13: vmalloc link failure

The following patch fixes this, and also fixes the similar problem in
scsi_debug.c:

<trond.myklebust@fys.uio.no>
--------------------------------------------------------------
[PATCH] in_ntoa link failure

Nothing serious. Whoever it was that did that global replacemissed a
spot is all...

<viro@math.psu.edu>
--------------------------------------------------------------
[PATCH] change_floppy() fix

Needed both in 2.4 and 2.5

--

#!/usr/bin/perl -w

use strict;

my %people = ();
my $addr = "";
my @cur = ();

sub append_item() {
if (!$addr) { return; }
if (!$people{$addr}) { @{$people{$addr}} = (); }
push @{$people{$addr}}, [@cur];

@cur = ();
}

while (<>) {
# Match address
if (/^\s*<([^>]+)>/) {
# Add old item (if any) before beginning new
append_item();
$addr = $1;
} elsif ($addr) {
# Add line to patch
s/^\s*(.*)\s*$/$1/;
push @cur, "\t$_\n";
} else {
# Header information
print;
}
}

sub print_items($) {
my @items = @{$people{$_[0]}};
# Vain attempt to sort patches from one address
@items = sort @items;
while ($_ = shift @items) {
# Item separator
print "\t--------------------------------------------------------------\n";
print @$_;
}
}

append_item();
foreach $addr (sort keys %people) {
print "<$addr>\n";
print_items($addr);
print "\n";
}