コード例 #1
0
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)
コード例 #2
0
ファイル: update.py プロジェクト: dcramer/gitboard
def update(hours):
    # from collections import defaultdict
    from gitboard.config import redis
    from gitboard.stats import Storage
    from gitboard.update import update_stats

    storage = Storage(redis)

    # scores = defaultdict(int)
    for repo in current_app.config["REPOS"]:
        click.echo("> Processing {}".format(repo))
        update_stats(repo)
        # print "----------------------------------------"
        # print "%dh Leaderboard for %s" % (hours, repo)
        # print "----------------------------------------"
        # i = 0
        # for author, score in storage.get_leaders(repo, hours):
        #     i += 1
        #     print "%d. %s (%s)" % (i, author, score)
        # print "----------------------------------------"

    click.echo("----------------------------------------")
    click.echo("%dh Global Leaderboard" % (hours,))
    click.echo("----------------------------------------")
    i = 0
    for author, score in storage.get_leaders(hours=hours):
        i += 1
        click.echo("%d. %s (%s)" % (i, author, score))
    click.echo("----------------------------------------")
コード例 #3
0
                '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