Commit ·
d584ff7
1
Parent(s): a1e1142
Update get_commits.py
Browse files40 unmodified lines4142434445464748495051525354555657585960616263646540 unmodified linesdef get_diff(ex):commit_id = ex["commit"]repo = ex["unnested_repo_name"]repo = "https://www.github.com/" + repo + ".git"old_file = ex["old_file"]new_file = ex["new_file"]# create a random directory to store the reporandom_dir = random.randint(0, 1000000)run_in_shell("mkdir " + str(random_dir))try:new_contents, old_contents = get_file_contents(commit_id, old_file, new_file, repo, cwd=str(random_dir))except Exception as e:print("ERROR", commit_id, old_file, new_file, repo, str(random_dir), e)run_in_shell("rm -rf " + str(random_dir))ex["new_contents"] = ""ex["old_contents"] = ""return exex["new_contents"] = new_contentsex["old_contents"] = old_contentsrun_in_shell("rm -rf " + str(random_dir))return exif __name__ == "__main__":40 unmodified lines41424344454647484950515253545556575859606162636465666740 unmodified linesdef get_diff(ex):commit_id = ex["commit"]repos = list(set(ex["repos"].split(",")))old_file = ex["old_file"]new_file = ex["new_file"]for repo in repos:repo = "https://www.github.com/" + repo + ".git"# create a random directory to store the reporandom_dir = random.randint(0, 1000000)run_in_shell("mkdir " + str(random_dir))try:new_contents, old_contents = get_file_contents(commit_id, old_file, new_file, repo, cwd=str(random_dir))except Exception as e:print("ERROR", commit_id, old_file, new_file, repo, str(random_dir), e)run_in_shell("rm -rf " + str(random_dir))continueex["new_contents"] = new_contentsex["old_contents"] = old_contentsrun_in_shell("rm -rf " + str(random_dir))return ex# If no repo workedex["new_contents"] = ""ex["old_contents"] = ""return exif __name__ == "__main__":
get_commits.py+17-15