[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [policies/master] Note commits-per-repo for individuals



commit 3b7f94be004ded3e17516835daf3fa3a280b493e
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Sun Oct 1 16:46:54 2017 -0700

    Note commits-per-repo for individuals
    
    Neat to include the repo count for individuals so we can tell where hotspots
    are...
    
      Nick Mathewson (nickm@xxxxxxxxxxxxxx): 1666
        1580 tor, 78 torspec, 4 chutney, 3 trunnel, 1 fuzzing-corpora
      Bisaloo (Bisaloo@xxxxxxxxxxxxxxxxxxxxxxxx): 710
        710 https-everywhere
      ...
---
 scripts/commit_activity.py | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/scripts/commit_activity.py b/scripts/commit_activity.py
index eeb5e02..ce57ee9 100644
--- a/scripts/commit_activity.py
+++ b/scripts/commit_activity.py
@@ -106,12 +106,16 @@ def call(cmd, cwd = None):
     return stdout.strip()
 
 
-def print_results(title, authors):
+def print_results(title, authors, repo_commits_per_user = None):
   print('%s:\n' % title)
 
   if authors:
     for author, count in sorted(collections.Counter(authors).items(), key = lambda entry: entry[1], reverse = True):
       print('  %s: %s' % (author, count))
+
+      if repo_commits_per_user:
+        repo_counts = ['%s %s' % (c, r) for (r, c) in sorted(repo_commits_per_user.get(author, {}).items(), key = lambda e: e[1], reverse = True)]
+        print('    %s' % ', '.join(repo_counts))
   else:
     print('  no activity')
 
@@ -121,7 +125,9 @@ def print_results(title, authors):
 if not os.path.exists(TMP_DIR):
   os.mkdir(TMP_DIR)
 
+inactive_repos = []
 all_author_emails = []
+repo_commits_per_user = {}  # mapping of {user => {repo => count}}
 
 for name, repo in sorted(GIT_REPOS.items(), key = lambda entry: entry[0]):
   repo_path = os.path.join(TMP_DIR, name)
@@ -135,6 +141,18 @@ for name, repo in sorted(GIT_REPOS.items(), key = lambda entry: entry[0]):
   print_results(name, author_emails)
   all_author_emails += author_emails
 
+  for author, count in collections.Counter(author_emails).items():
+    repo_commits_per_user.setdefault(author, {})[name] = count
+
+  if not author_emails:
+    inactive_repos.append(name)
+
+print('Inactive repositories:\n')
+
+for repo in inactive_repos:
+  print(' * %s' % repo)
+
+print('')
 
-print_results('Total commit counts', all_author_emails)
+print_results('Total commit counts', all_author_emails, repo_commits_per_user)
 

_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits