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
评论列表
文章目录