Skip to content

Commit

Permalink
Undo change, perform fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Oct 31, 2023
1 parent 02f3acf commit a5099bf
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 21 deletions.
49 changes: 28 additions & 21 deletions src/python/merge_analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,6 @@ def merge_analyzer( # pylint: disable=too-many-locals
left_success, _ = repo_left.checkout(merge_data["left"])
right_success, _ = repo_right.checkout(merge_data["right"])

if not left_success:
raise Exception(
"git checkout failed: ", repo_left.repo_path, merge_data["left"]
)
if not right_success:
raise Exception(
"git checkout failed: ", repo_right.repo_path, merge_data["right"]
)

# Compute diff size in lines between left and right
assert repo_left.repo_path.exists()
assert repo_right.repo_path.exists()
Expand Down Expand Up @@ -99,20 +90,36 @@ def merge_analyzer( # pylint: disable=too-many-locals
cache_data["diff_contains_java_file"] = contains_java_file

# Test left parent
cache_data["left_tree_fingerprint"] = repo_left.compute_tree_fingerprint()
result, test_coverage = repo_left.test(TIMEOUT_TESTING_PARENT, N_TESTS)
cache_data["left parent test result"] = result.name
cache_data["left parent test coverage"] = test_coverage
cache_data["parents pass"] = is_test_passed(cache_data["left parent test result"])
if not left_success:
# This should never happen. Search output for "Git_checkout_failed"
cache_data["left parent test result"] = TEST_STATE.Git_checkout_failed.name
cache_data["left_tree_fingerprint"] = None
cache_data["left parent test coverage"] = None
cache_data["parents pass"] = False
else:
cache_data["left_tree_fingerprint"] = repo_left.compute_tree_fingerprint()
result, test_coverage = repo_left.test(TIMEOUT_TESTING_PARENT, N_TESTS)
cache_data["left parent test result"] = result.name
cache_data["left parent test coverage"] = test_coverage
cache_data["parents pass"] = is_test_passed(
cache_data["left parent test result"]
)

# Test right parent
cache_data["right_tree_fingerprint"] = repo_right.compute_tree_fingerprint()
result, test_coverage = repo_right.test(TIMEOUT_TESTING_PARENT, N_TESTS)
cache_data["right parent test result"] = result.name
cache_data["right parent test coverage"] = test_coverage
cache_data["parents pass"] = cache_data["parents pass"] and is_test_passed(
cache_data["right parent test result"]
)
if not right_success:
# This should never happen. Search output for "Git_checkout_failed"
cache_data["right parent test result"] = TEST_STATE.Git_checkout_failed.name
cache_data["right_tree_fingerprint"] = None
cache_data["right parent test coverage"] = None
cache_data["parents pass"] = False
else:
cache_data["right_tree_fingerprint"] = repo_right.compute_tree_fingerprint()
result, test_coverage = repo_right.test(TIMEOUT_TESTING_PARENT, N_TESTS)
cache_data["right parent test result"] = result.name
cache_data["right parent test coverage"] = test_coverage
cache_data["parents pass"] = cache_data["parents pass"] and is_test_passed(
cache_data["right parent test result"]
)

cache_data["test merge"] = (
cache_data["parents pass"]
Expand Down
1 change: 1 addition & 0 deletions src/python/write_head_hashes.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ def clone_repo(repo_slug: str) -> git.repo.Repo:
except Exception as e:
print(repo_slug, "Exception during cloning:\n", e)
raise
repo.remote().fetch("refs/pull/*/head:refs/remotes/origin/pull/*")
return repo


Expand Down

0 comments on commit a5099bf

Please sign in to comment.