my ($committer, $patch, $log);
use Getopt::Long;
-my ($rank, $ta, @authors, %authors, %untraced, %patchers, %committers);
+my ($rank, $percentage, $cumulative, $reverse, $ta, @authors, %authors,
+ %untraced, %patchers, %committers);
my $result = GetOptions ("rank" => \$rank, # rank authors
"thanks-applied" => \$ta, # ranks committers
- "acknowledged=s" => \@authors); # authors files
+ "acknowledged=s" => \@authors , # authors files
+ "percentage" => \$percentage, # show as %age
+ "cumulative" => \$cumulative,
+ "reverse" => \$reverse,
+ );
if (!$result or (($rank||0) + ($ta||0) + (@authors ? 1 : 0) != 1) or !@ARGV) {
die <<"EOS";
$0 --rank Changelogs # rank authors by patches
$0 --acknowledged <authors file> Changelogs # Display unacknowledged authors
$0 --thanks-applied Changelogs # ranks committers
+$0 --percentage ... # show rankings as percentages
+$0 --cumulative ... # show rankings cumulatively
+$0 --reverse ... # show rankings in reverse
Specify stdin as - if needs be. Remember that option names can be abbreviated.
EOS
}
"whatever\100davidnicol.com" => "davidnicol\100gmail.com",
"rmgiroux\100acm.org" => "rmgiroux\100hotmail.com",
"smcc\100mit.edu" => "smcc\100ocf.berkeley.edu",
- "steven\100accognoscere.org" => "schubiger\100cpan.org",
+ "schubiger\100cpan.org" => "steven\100accognoscere.org",
"richard.foley\100ubsw.com"
=> "richard.foley\100t-online.de",
"damian\100cs.monash.edu.au" => "damian\100conway.org",
"paul.green\100stratus.com"
=> "paul_greenvos\100vos.stratus.com",
"alian\100cpan.org" => "alian\100alianwebserver.com",
+ "david.dyck\100fluke.com" => "dcd\100tc.fluke.com",
# Maybe we should special case this to get real names out?
"perlbug\100perl.org" => "perlbug-followup\100perl.org",
);
$map{"autrijus\100egb.elixus.org"} = $map{"autrijus\100geb.elixus.org"}
= $map{"autrijus\100gmail.com"} = $map{"autrijus\100ossf.iis.sinica.edu.tw"}
- = "autrijus\100autrijus.org";
+ = $map{"autrijus\100autrijus.org"} = "cpan\100audreyt.org";
$map{"ilya\100math.ohio-state.edu"} = $map{"ilya\100math.berkeley.edu"}
= $map{"ilya\100math.berkeley.edu"} = "nospam-abuse\100ilyaz.org";
$map{"philip.newton\100gmx.net"} = $map{"philip.newton\100datenrevision.de"}
$map{"(srezic\100iconmobile.com)"} = "slaven\100rezic.de";
$map{"perl\100dellah.anu.edu.au"} = "spoon\100cpan.org";
$map{"rjk-perl-p5p\100tamias.net"} = "rjk\100linguist.dartmouth.edu";
-$map{"sts\100accognoscere.org"} = "steven\100accognoscere.org";
+$map{"sts\100accognoscere.org"} = "schubiger\100cpan.org";
$map{"s.payrard\100wanadoo.fr"} = "stef\100mongueurs.net";
$map{"richard.foley\100ubs.com"} = "richard.foley\100ubsw.com";
# I assume that Ton Hopsel's lack of e-mail address in AUTHORS is deliberate
$map{"rgarciasuarez\100mandrakesoft.com"}
= $map{"rgarciasuarez\100mandriva.com"}
+ = $map{"rgarciasuarez\100gmail.com"}
= $map{"raphel.garcia-suarez\100hexaflux.com"} = "rgs";
$map{"jhietaniemi\100gmail.com"} = $map{"jhi\100kosh.hut.fi"}
= $map{"jhi\100cc.hut.fi"} = $map{"jarkko.hietaniemi\100nokia.com"} = "jhi";
$map{"nik\100tiuk.ti.com"} = $map{"nick.ing-simmons\100elixent.com"} = "nick";
$map{"hv\100crypt.org"} = "hv";
$map{"gisle\100aas.no"} = "gisle";
+$map{"gsar\100cpan.org"} = "gsar";
if (@authors) {
my %raw;
my $prefix = " " x length $1;
LOG: while (<>) {
next if /^$/;
+ s/^\t/ /;
if (s/^$prefix//) {
$log .= $_;
} elsif (/^\s+Branch:/) {
sub display_ordered {
my $what = shift;
my @sorted;
+ my $total;
while (my ($name, $count) = each %$what) {
push @{$sorted[$count]}, $name;
+ $total += $count;
}
my $i = @sorted;
- return unless $i;
- while (--$i) {
+ return unless @sorted;
+ my $sum = 0;
+ foreach my $i ($reverse ? 0 .. $#sorted : reverse 0 .. $#sorted) {
next unless $sorted[$i];
- print wrap ("$i:\t", "\t", join (" ", sort @{$sorted[$i]}), "\n");
+ my $prefix;
+ $sum += $i * @{$sorted[$i]};
+ # Value to display is either this one, or the cumulative sum.
+ my $value = $cumulative ? $sum : $i;
+ if ($percentage) {
+ $prefix = sprintf "%6.2f:\t", 100 * $value / $total;
+ } else {
+ $prefix = "$value:\t";
+ }
+ print wrap ($prefix, "\t", join (" ", sort @{$sorted[$i]}), "\n");
}
}