summaryrefslogtreecommitdiff
path: root/Porting/checkAUTHORS.pl
diff options
context:
space:
mode:
authorNicholas Clark <nick@ccl4.org>2006-05-02 22:16:25 +0000
committerNicholas Clark <nick@ccl4.org>2006-05-02 22:16:25 +0000
commit2b0ba25f0d6d021046bdee174d0cd9d6e42ab48a (patch)
treea4fe5d543ee7ac892359a8744c8f1f1478603c9b /Porting/checkAUTHORS.pl
parente51a6fb1d1bcc2e57ebd9a4f62d455d38645f6b8 (diff)
downloadperl-2b0ba25f0d6d021046bdee174d0cd9d6e42ab48a.tar.gz
cumulative totals and list reverse for checkAUTHORS.pl
p4raw-id: //depot/perl@28068
Diffstat (limited to 'Porting/checkAUTHORS.pl')
-rw-r--r--Porting/checkAUTHORS.pl20
1 files changed, 14 insertions, 6 deletions
diff --git a/Porting/checkAUTHORS.pl b/Porting/checkAUTHORS.pl
index 1eae53d838..4774c602a2 100644
--- a/Porting/checkAUTHORS.pl
+++ b/Porting/checkAUTHORS.pl
@@ -5,12 +5,14 @@ $Text::Wrap::columns = 80;
my ($committer, $patch, $log);
use Getopt::Long;
-my ($rank, $percentage, $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
"percentage" => \$percentage, # show as %age
+ "cumulative" => \$cumulative,
+ "reverse" => \$reverse,
);
if (!$result or (($rank||0) + ($ta||0) + (@authors ? 1 : 0) != 1) or !@ARGV) {
@@ -19,6 +21,8 @@ $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
}
@@ -281,14 +285,18 @@ sub display_ordered {
}
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];
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 * $i / $total;
+ $prefix = sprintf "%6.2f:\t", 100 * $value / $total;
} else {
- $prefix = "$i:\t";
+ $prefix = "$value:\t";
}
print wrap ($prefix, "\t", join (" ", sort @{$sorted[$i]}), "\n");
}