summaryrefslogtreecommitdiff
path: root/contrib/stats
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-07-14 20:43:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-07-14 20:43:49 (GMT)
commitaf6861b14488a91ab932c63852979eaf78b549d2 (patch)
tree5d815e854533dace1c7a461ab31a07887543eb73 /contrib/stats
parent9d6f220cc8ffbd71b4c68765b52c3a7c41dd729b (diff)
downloadgit-af6861b14488a91ab932c63852979eaf78b549d2.zip
git-af6861b14488a91ab932c63852979eaf78b549d2.tar.gz
git-af6861b14488a91ab932c63852979eaf78b549d2.tar.bz2
Add contrib/stats/mailmap.pl script
This script reads the existing commit log and .mailmap file, and outputs author e-mail addresses that would map to more than one names (most likely due to difference in the way they are spelled, but some are due to ancient botched commits). Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'contrib/stats')
-rwxr-xr-xcontrib/stats/mailmap.pl38
1 files changed, 38 insertions, 0 deletions
diff --git a/contrib/stats/mailmap.pl b/contrib/stats/mailmap.pl
new file mode 100755
index 0000000..4b852e2
--- /dev/null
+++ b/contrib/stats/mailmap.pl
@@ -0,0 +1,38 @@
+#!/usr/bin/perl -w
+my %mailmap = ();
+open I, "<", ".mailmap";
+while (<I>) {
+ chomp;
+ next if /^#/;
+ if (my ($author, $mail) = /^(.*?)\s+<(.+)>$/) {
+ $mailmap{$mail} = $author;
+ }
+}
+close I;
+
+my %mail2author = ();
+open I, "git log --pretty='format:%ae %an' |";
+while (<I>) {
+ chomp;
+ my ($mail, $author) = split(/\t/, $_);
+ next if exists $mailmap{$mail};
+ $mail2author{$mail} ||= {};
+ $mail2author{$mail}{$author} ||= 0;
+ $mail2author{$mail}{$author}++;
+}
+close I;
+
+while (my ($mail, $authorcount) = each %mail2author) {
+ # %$authorcount is ($author => $count);
+ # sort and show the names from the most frequent ones.
+ my @names = (map { $_->[0] }
+ sort { $b->[1] <=> $a->[1] }
+ map { [$_, $authorcount->{$_}] }
+ keys %$authorcount);
+ if (1 < @names) {
+ for (@names) {
+ print "$_ <$mail>\n";
+ }
+ }
+}
+