analyze.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:git-of-theseus 作者: erikbern 项目源码 文件源码
def get_file_histogram(commit, path):
    h = {}
    try:
        for old_commit, lines in repo.blame(commit, path):
            cohort = commit2cohort.get(old_commit.hexsha, "MISSING")
            h[cohort] = h.get(cohort, 0) + len(lines)

            if old_commit.hexsha in commit2timestamp:
                h[old_commit.hexsha] = h.get(old_commit.hexsha, 0) + len(lines)
            _, ext = os.path.splitext(path)

            h[ext] = h.get(ext, 0) + len(lines)
    except KeyboardInterrupt:
        raise
    except:
        traceback.print_exc()
    return h
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号