[pypy-commit] pypy default: be advanced: try hard to parse the pair programming markers in commit logs, and count them in the commit count :-)

antocuni noreply at buildbot.pypy.org
Sat Apr 7 21:01:59 CEST 2012


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r54238:97275a06775e
Date: 2012-04-07 21:00 +0200
http://bitbucket.org/pypy/pypy/changeset/97275a06775e/

Log:	be advanced: try hard to parse the pair programming markers in
	commit logs, and count them in the commit count :-)

diff --git a/pypy/doc/tool/makecontributor.py b/pypy/doc/tool/makecontributor.py
--- a/pypy/doc/tool/makecontributor.py
+++ b/pypy/doc/tool/makecontributor.py
@@ -8,50 +8,119 @@
 
 ROOT = py.path.local(__file__).join('..', '..', '..', '..')
 author_re = re.compile('(.*) <.*>')
-
-excluded = set(["pypy" "convert-repo"])
+pair_programming_re = re.compile(r'^\((.*?)\)')
+excluded = set(["pypy", "convert-repo"])
 
 alias = {
-    'arigo': 'Armin Rigo',
-    'lac': 'Laura Creighton',
-    'fijal': 'Maciej Fijalkowski',
-    'tismer at christia-wjtqxl.localdomain': 'Christian Tismer',
-    'holger krekel': 'Holger Krekel',
-    'hager': 'Sven Hager',
-    'mattip': 'Matti Picus',
-    'mattip>': 'Matti Picus',
-    'matthp': 'Matti Picus',
-    'Matti Picus matti.picus at gmail.com': '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 at goyle': 'Roberto De Ioris',
-    'roberto at mrspurr': 'Roberto De Ioris',
-    'landtuna at gmail.com': 'Jim Hunziker',
-    'kristjan at kristjan-lp.ccp.ad.local': 'Kristjan Valur Jonsson',
+    'Anders Chrigstrom': ['arre'],
+    'Antonio Cuni': ['antocuni', 'anto'],
+    'Armin Rigo': ['arigo', 'arfigo', 'armin', 'arigato'],
+    'Maciej Fijalkowski': ['fijal'],
+    'Carl Friedrich Bolz': ['cfbolz', 'cf'],
+    'Samuele Pedroni': ['pedronis', 'samuele', 'samule'],
+    'Michael Hudson': ['mwh'],
+    'Holger Krekel': ['hpk', 'holger krekel', 'holger', 'hufpk'],
+    "Amaury Forgeot d'Arc": ['afa'],
+    'Alex Gaynor': ['alex', 'agaynor'],
+    'David Schneider': ['bivab', 'david'],
+    'Christian Tismer': ['chris', 'christian', 'tismer',
+                         'tismer at christia-wjtqxl.localdomain'],
+    'Benjamin Peterson': ['benjamin'],
+    'Hakan Ardo': ['hakan', 'hakanardo'],
+    'Niklaus Haldimann': ['nik'],
+    'Alexander Schremmer': ['xoraxax'],
+    'Anders Hammarquist': ['iko'],
+    'David Edelsohn': ['edelsoh', 'edelsohn'],
+    'Niko Matsakis': ['niko'],
+    'Jakub Gustak': ['jlg'],
+    'Guido Wesdorp': ['guido'],
+    'Michael Foord': ['mfoord'],
+    'Mark Pearse': ['mwp'],
+    'Toon Verwaest': ['tverwaes'],
+    'Eric van Riet Paap': ['ericvrp'],
+    'Jacob Hallen': ['jacob', 'jakob'],
+    'Anders Lehmann': ['ale', 'anders'],
+    'Bert Freudenberg': ['bert'],
+    'Boris Feigin': ['boris', 'boria'],
+    'Valentino Volonghi': ['valentino', 'dialtone'],
+    'Aurelien Campeas': ['aurelien', 'aureliene'],
+    'Adrien Di Mascio': ['adim'],
+    'Jacek Generowicz': ['Jacek', 'jacek'],
+    'Jim Hunziker': ['landtuna at gmail.com'],
+    'Kristjan Valur Jonsson': ['kristjan at kristjan-lp.ccp.ad.local'],
+    'Laura Creighton': ['lac'],
+    'Aaron Iles': ['aliles'],
+    'Ludovic Aubry': ['ludal', 'ludovic'],
+    'Lukas Diekmann': ['l.diekmann', 'ldiekmann'],
+    'Matti Picus': ['Matti Picus matti.picus at gmail.com',
+                    'matthp', 'mattip', 'mattip>'],
+    'Michael Cheng': ['mikefc'],
+    'Richard Emslie': ['rxe'],
+    'Roberto De Ioris': ['roberto at goyle'],
+    'Roberto De Ioris': ['roberto at mrspurr'],
+    'Sven Hager': ['hager'],
+    'Tomo Cocoa': ['cocoatomo'],
     }
 
+alias_map = {}
+for name, nicks in alias.iteritems():
+    for nick in nicks:
+        alias_map[nick] = name
+
 def get_canonical_author(name):
     match = author_re.match(name)
     if match:
         name = match.group(1)
-    return alias.get(name, name)
+    return alias_map.get(name, name)
+
+ignored_nicknames = defaultdict(int)
+
+def get_more_authors(log):
+    match = pair_programming_re.match(log)
+    if not match:
+        return set()
+    ignore_words = ['around', 'consulting', 'yesterday', 'for a bit', 'thanks',
+                    'in-progress', 'bits of', 'even a little', 'floating',]
+    sep_words = ['and', ';', '+', '/', 'with special  by']
+    nicknames = match.group(1)
+    for word in ignore_words:
+        nicknames = nicknames.replace(word, '')
+    for word in sep_words:
+        nicknames = nicknames.replace(word, ',')
+    nicknames = [nick.strip().lower() for nick in nicknames.split(',')]
+    authors = set()
+    for nickname in nicknames:
+        author = alias_map.get(nickname)
+        if not author:
+            ignored_nicknames[nickname] += 1
+        else:
+            authors.add(author)
+    return authors
 
 def main(show_numbers):
     ui = mercurial.ui.ui()
     repo = mercurial.localrepo.localrepository(ui, str(ROOT))
-    authors = defaultdict(int)
+    authors_count = 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()
+        authors = set()
+        authors.add(get_canonical_author(ctx.user()))
+        authors.update(get_more_authors(ctx.description()))
+        for author in authors:
+            if author not in excluded:
+                authors_count[author] += 1
+
+    # uncomment the next lines to get the list of nicknamed which could not be
+    # parsed from commit logs
+    ## items = ignored_nicknames.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
+                
+    items = authors_count.items()
     items.sort(key=operator.itemgetter(1), reverse=True)
     for name, n in items:
         if show_numbers:


More information about the pypy-commit mailing list