Combining the efforts, the following almost makes coffee.
- Short mode
- Full mode
- Original mode
The original mode you requested prints the e-mail address, I guess
it should be the author's real name to look more nice.
#!/usr/bin/perl -w
use strict;
# 0 for short, 1 for full, 2 for "original changelog"
my $mode = 2;
# minimum space between entry and author for the original mode
my $space = 5;
my %people = ();
my $addr = "";
my @cur = ();
my $comment = 0;
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;
$comment = 1;
} elsif ($addr) {
# Add line to patch
s/^\s*(.*)\s*$/$1/;
$_ =~ s/\[PATCH\] //g;
$_ =~ s/\s*PATCH //g;
if ($comment == 1 or $mode != 0) {
push @cur, "$_\n";
$comment = 0;
}
} else {
# Header information
print;
}
}
append_item();
sub print_items($) {
my $person = $_[0];
my @items = @{$people{$person}};
# Vain attempt to sort patches from one address
@items = sort @items;
if ($mode == 0 or $mode == 1) {
print "<$person>\n";
} else {
$person = "($person)";
}
while ($_ = shift @items) {
if ($mode == 0) {
print "\to " . @$_[0];
} elsif ($mode == 1) {
print "\t------------------------------------------------------------\n";
foreach $_ (@$_) {
print "\t$_";
}
} elsif ($mode == 2) {
$_ = @$_[0];
chop;
$_ = "- $_";
# Split it onto two lines if necessary
if (length("$_ . $person") > 76 - $space) {
print ("$_\n" . " " x (76-length($person)) . "$person\n");
} else {
print ("$_" . " " x (76-length($person)-length($_)) . "$person\n");
}
}
}
}
# Print the information
foreach $addr (sort keys %people) {
print_items($addr);
if ($mode != 2) { print "\n"; }
}
-- Marcus Alanen maalanen@abo.fi - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/