def update_stats(repository): storage = Storage(redis.connect()) since = storage.get_last_commit(repository) commits = get_commits_since(repository, since=since) for revision, commit in commits.iteritems(): storage.store(repository, revision, **commit)
'files': int(stats[0]), 'insertions': int(stats[3]), 'deletions': int(stats[5]), } commits_by_author[author].append(revision) chunk = [] else: chunk.append(line) # git ls-tree -r HEAD # stdout = execute('git log --no-merges --all --format=oneline %s..%s' % (since or '', until), cwd=repo_path) return commits if __name__ == '__main__': storage = Storage(redis.connect()) hours = 24 scores = defaultdict(int) for repo in app.config['REPOS']: try: update_stats(repo) except: continue # print "----------------------------------------" # print "%dh Leaderboard for %s" % (hours, repo) # print "----------------------------------------" # i = 0 # for author, score in storage.get_leaders(repo, hours): # i += 1