forked from lscsoft/lalsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.mailmap-update
executable file
·62 lines (44 loc) · 1.74 KB
/
.mailmap-update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/perl
use strict;
my %name2mails;
my %cmail2cname;
open IN, ".mailmap" or die $!;
while (<IN>) {
chomp;
my ($pname, $pmail, $cname, $cmail) = /^([^<]*?)\s*<([^>]*)>(?:\s*([^<]*?)\s*<([^>]*)>)?$/ or die;
$cmail = $pmail if $cmail eq "";
$name2mails{$pname}->{$pmail} = -1;
$name2mails{$pname}->{$cmail} = 0 if !defined($name2mails{$pname}->{$cmail});
$cmail2cname{$cmail} = $cname;
}
close IN;
open IN, "git shortlog -s -e -n |" or die $!;
while (<IN>) {
chomp;
my ($n, $cname, $cmail) = m/^\s*(\d+)\s+([^<>]+)\s+<([^>]+)>\s*$/ or die;
$name2mails{$cname}->{$cmail} = $n if !defined($name2mails{$cname}->{$cmail});
}
close IN;
foreach my $pname (sort { $a cmp $b } keys(%name2mails)) {
my $pname2mail = lc($pname);
$pname2mail =~ s/\s+/./g;
my @pmails;
push @pmails, grep { /^${pname2mail}[@]ligo[.]org$/ } keys(%{$name2mails{$pname}});
push @pmails, grep { /^[a-z.-]+[@]ligo[.]org$/ } keys(%{$name2mails{$pname}});
push @pmails, grep { /[@]ligo[.]org$/ } keys(%{$name2mails{$pname}});
push @pmails, grep { $name2mails{$pname}->{$_} < 0 } keys(%{$name2mails{$pname}});
push @pmails, sort { $name2mails{$pname}->{$b} <=> $name2mails{$pname}->{$a} } keys(%{$name2mails{$pname}});
shift @pmails if $pmails[0] =~ /^albert[.]einstein@/i;
my $pmail = shift @pmails;
die "Could not determine email address for $pname" unless defined($pmail);
next unless keys(%{$name2mails{$pname}}) > 1 || $name2mails{$pname}->{$pmail} <= 0;
print "$pname <$pmail>\n";
foreach my $mail (sort { $a cmp $b } keys(%{$name2mails{$pname}})) {
next if $mail eq $pmail;
if ($cmail2cname{$mail} ne "") {
print "$pname <$pmail> $cmail2cname{$mail} <$mail>\n";
} else {
print "$pname <$pmail> <$mail>\n";
}
}
}