-
Notifications
You must be signed in to change notification settings - Fork 752
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
26 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# 1. Visual inspection: python mkcontrib.py | ||
# 2. If OK, python mkcontrib.py | grep -v ^# > CONTRIB | ||
|
||
from subprocess import Popen, PIPE | ||
from collections import defaultdict, Counter | ||
|
||
p = Popen(["git","log","--no-merges","--format=%aN <%aE>"], stdout=PIPE).stdout | ||
common_email = defaultdict(Counter) | ||
common_name = defaultdict(Counter) | ||
for line in p: | ||
author, email = line.rstrip().split('<') | ||
common_email[author].update([email]) | ||
common_name[email].update([author]) | ||
|
||
for email in common_name: | ||
names = common_name[email] | ||
names = sorted(names, key=lambda x: (names[x], len(x)), reverse=True) | ||
for name in names[1:]: | ||
common_email[names[0]] += common_email[name] | ||
del common_email[name] | ||
print '# Less common or shorter name', name, 'is replaced by', names[0] | ||
|
||
for name in sorted(common_email): | ||
for k in common_email[name].most_common()[1:]: | ||
print '# Less common email <' + k[0] + ' is removed.' | ||
print name + '<' + common_email[name].most_common(1)[0][0] |