Last active
August 29, 2015 14:20
-
-
Save nip3o/585fcd581a1d2f1641c6 to your computer and use it in GitHub Desktop.
PelmeCommitCounter
This file contains hidden or 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
from github import Github | |
from collections import defaultdict | |
from datetime import datetime | |
g = Github('...', '...') | |
SCRIPT = 'SCRIPT' | |
HKC = 'HKC' | |
OTHER = 'OTHER' | |
commits = defaultdict(set) | |
insertions = defaultdict(int) | |
deletions = defaultdict(int) | |
pk = g.get_repo('personalkollen/personalkollen') | |
for commit in pk.get_commits(since=datetime(2015, 1, 1), author='pelme'): | |
for f in commit.files: | |
if 'scripts' in f.filename: | |
insertions[SCRIPT] += f.additions | |
deletions[SCRIPT] += f.deletions | |
commits[SCRIPT].add(commit) | |
if 'hkc' in f.filename: | |
insertions[HKC] += f.additions | |
deletions[HKC] += f.deletions | |
commits[HKC].add(commit) | |
elif 'scripts' not in f.filename: | |
insertions[OTHER] += f.additions | |
deletions[OTHER] += f.deletions | |
commits[OTHER].add(commit) | |
commit_count = { | |
key: len(value) for key, value in commits.iteritems() | |
} | |
print commit_count | |
print dict(insertions) | |
print dict(deletions) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment