summaryrefslogtreecommitdiff
path: root/Porting/checkAUTHORS.pl
diff options
context:
space:
mode:
authorJesse Vincent <jesse@bestpractical.com>2010-07-04 10:38:50 -0400
committerJesse Vincent <jesse@bestpractical.com>2010-07-04 21:43:39 +0100
commite427132caf5b9f01844e68110587dea2807fd8f7 (patch)
treed8939d6c93e25586fe194546c57b03157aaf1765 /Porting/checkAUTHORS.pl
parent93456aa7fb233edbe9ecd9f6eeee5972d2671f28 (diff)
downloadperl-e427132caf5b9f01844e68110587dea2807fd8f7.tar.gz
refactoring checkAUTHORS in advance of testifcation
Diffstat (limited to 'Porting/checkAUTHORS.pl')
-rw-r--r--Porting/checkAUTHORS.pl127
1 files changed, 71 insertions, 56 deletions
diff --git a/Porting/checkAUTHORS.pl b/Porting/checkAUTHORS.pl
index 3995a2fad9..424c3c593a 100644
--- a/Porting/checkAUTHORS.pl
+++ b/Porting/checkAUTHORS.pl
@@ -29,9 +29,69 @@ EOS
}
-my $prev = "";
-my %map;
+my $map = generate_author_map();
+
+
+if (@authors) {
+ my %raw;
+ foreach my $filename (@authors) {
+ open FH, "<$filename" or die "Can't open $filename: $!";
+ while (<FH>) {
+ next if /^\#/;
+ next if /^-- /;
+ if (/<([^>]+)>/) {
+ # Easy line.
+ $raw{$1}++;
+ } elsif (/^([-A-Za-z0-9 .\'À-ÖØöø-ÿ]+)[\t\n]/) {
+ # Name only
+ $untraced{$1}++;
+ } elsif (length $_) {
+ chomp;
+ warn "Can't parse line '$_'";
+ } else {
+ next
+ }
+ }
+ }
+ foreach (keys %raw) {
+ print "E-mail $_ occurs $raw{$_} times\n" if $raw{$_} > 1;
+ $_ = lc $_;
+ $authors{$map->{$_} || $_}++;
+ }
+ ++$authors{'!'};
+ ++$authors{'?'};
+}
+
+my @lines = split(/^commit\s*/sm,join('',<>));
+for ( @lines) {
+ next if m/^$/;
+ next if m/^(\S*?)^Merge:/ism; # skip merge commits
+if (m/^(.*?)^Author:\s*(.*?)^AuthorDate:\s*(.*?)^Commit:\s*(.*?)^(.*)$/gism) {
+ # new patch
+ ($patch, $author, $date, $committer) = ($1,$2,$3,$4);
+ chomp($author);
+ unless ($author) { die $_}
+ chomp($committer);
+ unless ($committer) { die $_}
+ &process($committer, $patch, $author);
+} else { die "XXX $_ did not match";}
+}
+
+
+if ($rank) {
+ display_ordered(\%patchers);
+} elsif ($ta) {
+ display_ordered(\%committers);
+} elsif (%authors) {
+ display_missing_authors(\%patchers, \%authors, \%real_names);
+}
+
+exit(0);
+sub generate_author_map {
+ my %map;
+
+my $prev = "";
while (<DATA>) {
chomp;
s/\\100/\@/g;
@@ -113,61 +173,16 @@ $map {$_} = '!' for
"(none)",
;
-
-if (@authors) {
- my %raw;
- foreach my $filename (@authors) {
- open FH, "<$filename" or die "Can't open $filename: $!";
- while (<FH>) {
- next if /^\#/;
- next if /^-- /;
- if (/<([^>]+)>/) {
- # Easy line.
- $raw{$1}++;
- } elsif (/^([-A-Za-z0-9 .\'À-ÖØöø-ÿ]+)[\t\n]/) {
- # Name only
- $untraced{$1}++;
- } elsif (length $_) {
- chomp;
- warn "Can't parse line '$_'";
- } else {
- next
- }
- }
- }
- foreach (keys %raw) {
- print "E-mail $_ occurs $raw{$_} times\n" if $raw{$_} > 1;
- $_ = lc $_;
- $authors{$map{$_} || $_}++;
- }
- ++$authors{'!'};
- ++$authors{'?'};
+ return \%map;
}
-my @lines = split(/^commit\s*/sm,join('',<>));
-for ( @lines) {
- next if m/^$/;
- next if m/^(\S*?)^Merge:/ism; # skip merge commits
-if (m/^(.*?)^Author:\s*(.*?)^AuthorDate:\s*(.*?)^Commit:\s*(.*?)^(.*)$/gism) {
- # new patch
- ($patch, $author, $date, $committer) = ($1,$2,$3,$4);
- chomp($author);
- unless ($author) { die $_}
- chomp($committer);
- unless ($committer) { die $_}
- &process($committer, $patch, $author);
-} else { die "XXX $_ did not match";}
-}
-
-
-if ($rank) {
- &display_ordered(\%patchers);
-} elsif ($ta) {
- &display_ordered(\%committers);
-} elsif (%authors) {
+sub display_missing_authors {
+ my $patchers = shift;
+ my $authors = shift;
+ my $real_names = shift;
my %missing;
- foreach (sort keys %patchers) {
- next if $authors{$_};
+ foreach (sort keys %$patchers) {
+ next if $authors->{$_};
# Sort by number of patches, then name.
$missing{$patchers{$_}}->{$_}++;
}
@@ -176,7 +191,7 @@ if ($rank) {
foreach my $author (sort keys %{$missing{$patches}}) {
my $xauthor = $author;
$xauthor =~ s/@/\\100/g; # xxx temp hack
- print "".($real_names{$author}||$author) ."\t\t\t<" . $xauthor.">\n" ;
+ print "".($real_names->{$author}||$author) ."\t\t\t<" . $xauthor.">\n" ;
}
}
}
@@ -233,7 +248,7 @@ sub _raw_address {
$addr =~ s/\[mailto://;
$addr =~ s/\]//;
$addr = lc $addr;
- $addr = $map{$addr} || $addr;
+ $addr = $map->{$addr} || $addr;
$addr =~ s/\\100/@/g; # Sometimes, there are encoded @ signs in the git log.
if ($real_name) { $real_names{$addr} = $real_name};