Muennighoff
commited on
Commit
•
fae37a0
1
Parent(s):
40ebbcf
Update get_commits.py
Browse files- get_commits.py +4 -0
get_commits.py
CHANGED
@@ -24,6 +24,10 @@ def get_file_contents(commit, old_file, new_file, repo, cwd=None):
|
|
24 |
completed = run_in_shell("git init", cwd=cwd)
|
25 |
completed = run_in_shell("git remote add origin " + repo, cwd=cwd)
|
26 |
completed = run_in_shell("git fetch --depth 2 origin " + commit, cwd=cwd)
|
|
|
|
|
|
|
|
|
27 |
completed = run_in_shell("git checkout FETCH_HEAD -- " + new_file, cwd=cwd)
|
28 |
new_contents = run_in_shell("cat " + new_file, cwd=cwd).stdout.decode()
|
29 |
completed = run_in_shell("git checkout FETCH_HEAD^ -- " + old_file, cwd=cwd)
|
|
|
24 |
completed = run_in_shell("git init", cwd=cwd)
|
25 |
completed = run_in_shell("git remote add origin " + repo, cwd=cwd)
|
26 |
completed = run_in_shell("git fetch --depth 2 origin " + commit, cwd=cwd)
|
27 |
+
# If it times out as repo requires a username
|
28 |
+
if completed.returncode != 0:
|
29 |
+
return (new_contents, "")
|
30 |
+
old_contents = run_in_shell("cat " + old_file, cwd=cwd).stdout.decode()
|
31 |
completed = run_in_shell("git checkout FETCH_HEAD -- " + new_file, cwd=cwd)
|
32 |
new_contents = run_in_shell("cat " + new_file, cwd=cwd).stdout.decode()
|
33 |
completed = run_in_shell("git checkout FETCH_HEAD^ -- " + old_file, cwd=cwd)
|