Author: Antonio Cuni <[email protected]>
Branch: 
Changeset: r54237:df57ca3b7687
Date: 2012-04-07 19:56 +0200
http://bitbucket.org/pypy/pypy/changeset/df57ca3b7687/

Log:    a script to update the contributors list

diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py
new file mode 100644
--- /dev/null
+++ b/pypy/doc/tool/makecontributor.py
@@ -0,0 +1,64 @@
+import py
+import sys
+from collections import defaultdict
+import operator
+import re
+import mercurial.localrepo
+import mercurial.ui
+
+ROOT = py.path.local(__file__).join('..', '..', '..', '..')
+author_re = re.compile('(.*) <.*>')
+
+excluded = set(["pypy" "convert-repo"])
+
+alias = {
+    'arigo': 'Armin Rigo',
+    'lac': 'Laura Creighton',
+    'fijal': 'Maciej Fijalkowski',
+    '[email protected]': 'Christian Tismer',
+    'holger krekel': 'Holger Krekel',
+    'hager': 'Sven Hager',
+    'mattip': 'Matti Picus',
+    'mattip>': 'Matti Picus',
+    'matthp': 'Matti Picus',
+    'Matti Picus [email protected]': 'Matti Picus',
+    'edelsohn': 'David Edelsohn',
+    'edelsoh': 'David Edelsohn',
+    'l.diekmann': 'Lukas Diekmann',
+    'ldiekmann': 'Lukas Diekmann',
+    'aliles': 'Aaron Iles',
+    'mikefc': 'Michael Cheng',
+    'cocoatomo': 'Tomo Cocoa',
+    'roberto@goyle': 'Roberto De Ioris',
+    'roberto@mrspurr': 'Roberto De Ioris',
+    '[email protected]': 'Jim Hunziker',
+    '[email protected]': 'Kristjan Valur Jonsson',
+    }
+
+def get_canonical_author(name):
+    match = author_re.match(name)
+    if match:
+        name = match.group(1)
+    return alias.get(name, name)
+
+def main(show_numbers):
+    ui = mercurial.ui.ui()
+    repo = mercurial.localrepo.localrepository(ui, str(ROOT))
+    authors = defaultdict(int)
+    for i in repo:
+        ctx = repo[i]
+        author = get_canonical_author(ctx.user())
+        if author not in excluded:
+            authors[author] += 1
+    #
+    items = authors.items()
+    items.sort(key=operator.itemgetter(1), reverse=True)
+    for name, n in items:
+        if show_numbers:
+            print '%5d %s' % (n, name)
+        else:
+            print name
+
+if __name__ == '__main__':
+    show_numbers = '-n' in sys.argv
+    main(show_numbers)
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to