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