Commit ·
12cb6ed
1
Parent(s): c4d6e89
Update get_commits.py
Browse files21 unmodified lines2223242525272629273132283429363031323933343521 unmodified linesdef get_file_contents(commit, old_file, new_file, repo, cwd=None):
completed = run_in_shell("git init", cwd=cwd) print(completed) completed = run_in_shell("git remote add origin " + repo, cwd=cwd) print(completed) completed = run_in_shell("git fetch --depth 2 origin " + commit, cwd=cwd) print(completed) completed = run_in_shell("git checkout FETCH_HEAD -- " + new_file, cwd=cwd) print(completed)
new_contents = run_in_shell("cat " + new_file, cwd=cwd).stdout.decode()
completed = run_in_shell("git checkout FETCH_HEAD^ -- " + old_file, cwd=cwd) print(completed) # If there's only a new file, but no old file if completed.returncode != 0: return (new_contents, "")
old_contents = run_in_shell("cat " + old_file, cwd=cwd).stdout.decode() return (new_contents, old_contents)
get_commits.py+1-8