use Text::Wrap;
$Text::Wrap::columns = 80;
-my ($rank, $percentage, $cumulative, $reverse, $ta, @authors, %authors,
- %untraced, %patchers, %committers, %real_names, $as_test_output);
-my $result = GetOptions ("rank" => \$rank, # rank authors
- "thanks-applied" => \$ta, # ranks committers
- "acknowledged=s" => \@authors , # authors files
+my ($rank, $ta, $ack, $who, $tap) = (0) x 5;
+my ($author_file, $percentage, $cumulative, $reverse);
+my (%authors, %untraced, %patchers, %committers, %real_names);
+
+my $result = GetOptions (
+ # modes
+ "who" => \$who,
+ "rank" => \$rank,
+ "thanks-applied" => \$ta,
+ "missing" => \$ack ,
+ "tap" => \$tap,
+ # modifiers
+ "authors" => \$author_file,
"percentage" => \$percentage, # show as %age
"cumulative" => \$cumulative,
"reverse" => \$reverse,
- "tap" => \$as_test_output,
);
-if (!$result or (($rank||0) + ($ta||0) + (@authors ? 1 : 0) != 1) or !@ARGV) {
+if (!$result or ( $rank + $ta + $who + $ack + $tap != 1 ) or !@ARGV) {
usage();
}
+$author_file ||= './AUTHORS';
+die "Can't locate '$author_file'. Specify it with '--author <path>'."
+ unless -f $author_file;
+
my $map = generate_known_author_map();
-read_authors_files(@authors);
+read_authors_files($author_file);
parse_commits_from_stdin();
display_ordered(\%patchers);
} elsif ($ta) {
display_ordered(\%committers);
-} elsif ($as_test_output) {
+} elsif ($tap) {
display_test_output(\%patchers, \%authors, \%real_names);
-} elsif (%authors) {
+} elsif ($ack) {
display_missing_authors(\%patchers, \%authors, \%real_names);
+} elsif ($who) {
+ list_authors(\%patchers, \%authors);
}
-
-
exit(0);
sub usage {
die <<"EOS";
-$0 --rank changes # rank authors by patches
-$0 --acknowledged <authors file> changes # Display unacknowledged authors
-$0 --thanks-applied changes # ranks committers of others' patches
-$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.
-Generate changes with git log --pretty=fuller rev1..rev2
+Usage: $0 [modes] [modifiers] <git-log-output-file>
+
+Modes (use only one):
+ --who # show list of unique authors by full name
+ --rank # rank authors by patches
+ --thanks-applied # ranks committers of others' patches
+ --missing # display authors not in AUTHORS
+ --tap # show authors present/missing as TAP
+
+Modifiers:
+ --authors <authors-file> # path to authors file (default: ./AUTHORS)
+ --percentage # show rankings as percentages
+ --cumulative # show rankings cumulatively
+ --reverse # show rankings in reverse
+
+Generate git-log-output-file with git log --pretty=fuller rev1..rev2
+(or pipe by specifying '-' for stdin). For example:
+ \$ git log --pretty=fuller v5.12.0..v5.12.1 > gitlog
+ \$ perl Porting/checkAUTHORS.pl --rank --percentage gitlog
EOS
}
-
+sub list_authors {
+ my ($patchers, $authors) = @_;
+ binmode(STDOUT, ":utf8");
+ print "$_\n" for sort { lc $a cmp lc $b }
+ map { $authors->{$_} }
+ keys %$patchers;
+}
sub parse_commits_from_stdin {
my @lines = split( /^commit\s*/sm, join( '', <> ) );
sub read_authors_files {
my @authors = (@_);
return unless (@authors);
- my %raw;
+ my (%count, %raw);
foreach my $filename (@authors) {
open FH, "<$filename" or die "Can't open $filename: $!";
+ binmode FH, ':encoding(ISO-8859-1)';
while (<FH>) {
next if /^\#/;
next if /^-- /;
- if (/<([^>]+)>/) {
-
+ if (/^([^<]+)<([^>]+)>/) {
# Easy line.
- $raw{$1}++;
+ my ($name, $email) = ($1, $2);
+ $name =~ s/\s*\z//;
+ $raw{$email} = $name;
+ $count{$email}++;
} elsif (/^([-A-Za-z0-9 .\'À-ÖØöø-ÿ]+)[\t\n]/) {
# Name only
}
}
foreach ( keys %raw ) {
- print "E-mail $_ occurs $raw{$_} times\n" if $raw{$_} > 1;
- $_ = lc $_;
- $authors{ $map->{$_} || $_ }++;
+ print "E-mail $_ occurs $count{$_} times\n" if $count{$_} > 1;
+ my $lc = lc $_;
+ $authors{ $map->{$lc} || $lc } = $raw{$_};
}
- ++$authors{'!'};
- ++$authors{'?'};
+ $authors{$_} = $_ for qw(? !);
}
sub display_test_output {
# List of mappings. First entry the "correct" email address, as appears
# in the AUTHORS file. Second is any "alias" mapped to it.
#
-# If the "correct" email address is a '+', the entry above is reused;
+# If the "correct" email address is a '+', the entry above is reused;
# this for addresses with more than one alias.
#
# Note that all entries are in lowercase. Further, no '@' signs should
+ root\100dixie.cscaper.com
timb Tim.Bunce\100pobox.com
+ tim.bunce\100ig.co.uk
-
+tonyc tony\100develop-help.com
++ tony\100openbsd32.tony.develop-help.com
#
# Mere mortals.
+ siegel\100zrz.tu-berlin.de
arnold\100gnu.ai.mit.edu arnold\100emoryu2.arpa
+ gatech!skeeve!arnold
+arodland\100cpan.org andrew\100hbslabs.com
arussell\100cs.uml.edu adam\100adam-pc.(none)
ash\100cpan.org ash_cpan\100firemirror.com
avarab\100gmail.com avar\100cpan.org
bepi\100perl.it enrico.sorcinelli\100gmail.com
bert\100alum.mit.edu bert\100genscan.com
bigbang7\100gmail.com ddascalescu+github\100gmail.com
-blgl\100hagernas.com blgl\100stacken.kth.se
+blgl\100stacken.kth.se blgl\100hagernas.com
brian.d.foy\100gmail.com bdfoy\100cpan.org
BQW10602\100nifty.com sadahiro\100cpan.org
jbuehler\100hekimian.com jhpb\100hekimian.com
jcromie\100100divsol.com jcromie\100cpan.org
+ jim.cromie\100gmail.com
-jidanni\100jidanni.org jidanni\100hoffa.dreamhost.com
jdhedden\100cpan.org jerry\100hedden.us
+ jdhedden\1001979.usna.com
+ jdhedden\100gmail.com
jesse\100sig.bsh.com jesse\100ginger
jfriedl\100yahoo.com jfriedl\100yahoo-inc.com
jfs\100fluent.com jfs\100jfs.fluent.com
-jhannah\100omnihotels.com jay\100jays.net
+jhannah\100mutationgrid.com jay\100jays.net
++ jhannah\100omnihotels.com
+jidanni\100jidanni.org jidanni\100hoffa.dreamhost.com
jjore\100cpan.org twists\100gmail.com
jns\100integration-house.com jns\100gellyfish.com
+ gellyfish\100gellyfish.com
+ lwall\100scalpel.netlabs.com
laszlo.molnar\100eth.ericsson.se molnarl\100cdata.tvnet.hu
+ ml1050\100freemail.hu
-lewart\100uiuc.edu lewart\100vadds.cvm.uiuc.edu
+lewart\100uiuc.edu lewart\100vadds.cvm.uiuc.edu
+ d-lewart\100uiuc.edu
lkundrak\100v3.sk lubo.rintel\100gooddata.com
lstein\100cshl.org lstein\100formaggio.cshl.org
marcel\100codewerk.com gr\100univie.ac.at
mark.p.lutz\100boeing.com tecmpl1\100triton.ca.boeing.com
marnix\100gmail.com pttesac!marnix!vanam
+marty+p5p\100kasei.com marty\100martian.org
mats\100sm6sxl.net mats\100sm5sxl.net
mbarbon\100dsi.unive.it mattia.barbon\100libero.it
mcmahon\100ibiblio.org mcmahon\100metalab.unc.edu
mlh\100swl.msd.ray.com webtools\100uewrhp03.msd.ray.com
michael.schroeder\100informatik.uni-erlangen.de mls\100suse.de
mike\100stok.co.uk mike\100exegenix.com
+miyagawa\100bulknews.net miyagawa\100edge.co.jp
mjtg\100cam.ac.uk mjtg\100cus.cam.ac.uk
mikedlr\100tardis.ed.ac.uk mikedlr\100it.com.pl
moritz\100casella.verplant.org moritz\100faui2k3.org
+ [9]ilya\100math.ohio-state.edu
ilya\100martynov.org ilya\100juil.nonet
+joshua.pritikin\100db.com joshua\100paloalto.com
+
okamoto\100corp.hp.com okamoto\100hpcc123.corp.hp.com
orwant\100oreilly.com orwant\100media.mit.edu
perl\100profvince.com vince\100profvince.com
perl-rt\100wizbit.be p5p\100perl.wizbit.be
# Maybe we should special case this to get real names out?
-Peter.Dintelmann\100Dresdner-Bank.com peter.dintelmann\100dresdner-bank.com
+Peter.Dintelmann\100Dresdner-Bank.com peter.dintelmann\100dresdner-bank.com
# NOTE: There is an intentional trailing space in the line above
pfeifer\100wait.de pfeifer\100charly.informatik.uni-dortmund.de
+ upf\100de.uu.net
rabbit\100rabbit.us rabbit+bugs\100rabbit.us
+perl\100aaroncrane.co.uk arc\100cpan.org
phil\100perkpartners.com phil\100finchcomputer.com
pimlott\100idiomtech.com andrew\100pimlott.net
+ pimlott\100abel.math.harvard.edu
radu\100netsoft.ro rgreab\100fx.ro
raphael.manfredi\100pobox.com raphael_manfredi\100grenoble.hp.com
-renee.baecker\100smart-websolutions.de reneeb\100reneeb-desktop.(none)
+module@renee-baecker.de renee.baecker\100smart-websolutions.de
++ reneeb\100reneeb-desktop.(none)
++ otrs\100ubuntu.(none)
richard.foley\100rfi.net richard.foley\100t-online.de
+ richard.foley\100ubs.com
+ richard.foley\100ubsw.com
+ robin.barker\100npl.co.uk
+ rmb\100cise.npl.co.uk
+ robin\100spade-ubuntu.(none)
++ r.m.barker\100btinternet.com
++ rmbarker.cpan\100btinternet.com
robertmay\100cpan.org rob\100themayfamily.me.uk
roberto\100keltia.freenix.fr roberto\100eurocontrol.fr
robin\100cpan.org robin\100kitsite.com
tjenness\100cpan.org t.jenness\100jach.hawaii.edu
+ timj\100jach.hawaii.edu
tobez\100tobez.org tobez\100plab.ku.dk
+toddr\100cpanel.net toddr\100cpan.org
tom\100compton.nu thh\100cyberscience.com
tom.horsley\100mail.ccur.com tom.horsley\100ccur.com
+ tom\100amber.ssd.hcsc.com
+ vadim\100vkonovalov.ru
+ vkonovalov\100spb.lucent.com
+ vkonovalov\100alcatel-lucent.com
++ vadim.konovalov\100alcatel-lucent.com
whatever\100davidnicol.com davidnicol\100gmail.com
wolfgang.laun\100alcatel.at wolfgang.laun\100chello.at