git.py 文件源码

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

项目:git-stacktrace 作者: pinterest 项目源码 文件源码
def files_touched(git_range):
    """Run git log --pretty="%H" --raw  git_range.

    Generate a dictionary of files modified by the commits in range
    """
    cmd = 'git', 'log', '--pretty=%H', '--raw', git_range
    data = run_command(*cmd)
    commits = collections.defaultdict(list)
    commit = None
    for line in data.splitlines():
        if SHA1_REGEX.match(line):
            commit = line
        elif line.strip():
            split_line = line.split('\t')
            filename = split_line[-1]
            state = split_line[0].split(' ')[-1][0]
            commits[commit].append(GitFile(filename, state))
    return commits
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号