Skip to content

Instantly share code, notes, and snippets.

@sbenthall
Created July 12, 2012 16:03
Show Gist options
  • Save sbenthall/3099040 to your computer and use it in GitHub Desktop.
Save sbenthall/3099040 to your computer and use it in GitHub Desktop.
from collections import defaultdict
import datetime
from git import *
from operator import itemgetter
import os
from pprint import pprint as pp
repo = Repo(os.getcwd())
six_months_ago = (datetime.date.today() - datetime.timedelta(183)).isoformat()
commits = repo.iter_commits(after=six_months_ago)
authors = defaultdict(int)
for commit in commits:
authors[commit.author.name] += 1
rank_authors = sorted(authors.items(),key=itemgetter(1), reverse=True)
pp(rank_authors)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment