diff --git a/src/python/merge_analyzer.py b/src/python/merge_analyzer.py index 54719a2b85..4af492ef4f 100755 --- a/src/python/merge_analyzer.py +++ b/src/python/merge_analyzer.py @@ -42,7 +42,7 @@ def merge_analyzer( # pylint: disable=too-many-locals Merges two branches and returns the result. Args: args (Tuple[str,pd.Series,Path]): A tuple containing the repo slug, - the merge data, and the cache path. + the merge data (which is side-effected), and the cache path. Returns: dict: A dictionary containing the merge result. """ @@ -58,10 +58,20 @@ def merge_analyzer( # pylint: disable=too-many-locals return merge_data cache_data = {} - repo_left = Repository(repo_slug, cache_directory=cache_directory) - repo_right = Repository(repo_slug, cache_directory=cache_directory) - left_success, _ = repo_left.checkout(merge_data["left"]) - right_success, _ = repo_right.checkout(merge_data["right"]) + left_sha = merge_data["left"] + right_sha = merge_data["right"] + repo_left = Repository( + repo_slug, + cache_directory=cache_directory, + workdir_id="left-" + left_sha + "-" + right_sha, + ) + repo_right = Repository( + repo_slug, + cache_directory=cache_directory, + workdir_id="right-" + left_sha + "-" + right_sha, + ) + left_success, _ = repo_left.checkout(left_sha) + right_success, _ = repo_right.checkout(right_sha) # Compute diff size in lines between left and right assert repo_left.repo_path.exists() diff --git a/src/python/merge_differ.py b/src/python/merge_differ.py index cd8e3a60fa..4bda04d725 100755 --- a/src/python/merge_differ.py +++ b/src/python/merge_differ.py @@ -51,7 +51,11 @@ def get_merge_fingerprint( return None, None left = merge_data["left"] right = merge_data["right"] - repo = Repository(repo_slug, cache_directory=cache_directory) + repo = Repository( + repo_slug, + cache_directory=cache_directory, + workdir_id="merge-differ-" + left + "-" + right, + ) ( merge_status, merge_fingerprint, diff --git a/src/python/merge_tester.py b/src/python/merge_tester.py index 9564194091..0a16360a46 100755 --- a/src/python/merge_tester.py +++ b/src/python/merge_tester.py @@ -52,7 +52,11 @@ def merge_tester(args: Tuple[str, pd.Series, Path]) -> pd.Series: merge_data["parents pass"] = False for branch in ["left", "right"]: commit_sha = merge_data[branch] - repo = Repository(repo_slug, cache_directory=cache_directory) + repo = Repository( + repo_slug, + cache_directory=cache_directory, + workdir_id="test-" + branch + "-" + commit_sha, + ) test_result, test_coverage, tree_fingerprint = repo.checkout_and_test( commit_sha, TIMEOUT_TESTING_PARENT, N_TESTS ) @@ -77,7 +81,12 @@ def merge_tester(args: Tuple[str, pd.Series, Path]) -> pd.Series: merge_data["parents pass"] = True for merge_tool in MERGE_TOOL: - repo = Repository(repo_slug, cache_directory=cache_directory) + repo = Repository( + repo_slug, + cache_directory=cache_directory, + workdir_id=f"merge-tester-{merge_tool.name}-" + + f'{merge_data["left"]}-{merge_data["right"]}', + ) ( result, merge_fingerprint, diff --git a/src/python/repo.py b/src/python/repo.py index 0d67f756fa..aaf562b032 100755 --- a/src/python/repo.py +++ b/src/python/repo.py @@ -113,6 +113,7 @@ def __init__( self, repo_slug: str, cache_directory: Path = Path(""), + workdir_id=uuid.uuid4().hex, # uuid4 is a random UID ) -> None: """Initializes the repository. Args: @@ -121,7 +122,6 @@ def __init__( """ self.repo_slug = repo_slug self.path = REPOS_PATH / repo_slug.split("/")[1] - workdir_id = uuid.uuid4().hex self.workdir = WORKDIR_DIRECTORY / workdir_id self.workdir.mkdir(parents=True, exist_ok=True) self.repo_path = self.workdir / self.path.name diff --git a/src/python/test_repo_heads.py b/src/python/test_repo_heads.py index 093ab3a9d7..b105721bbc 100755 --- a/src/python/test_repo_heads.py +++ b/src/python/test_repo_heads.py @@ -43,7 +43,11 @@ def head_passes_tests(args: Tuple[pd.Series, Path]) -> TEST_STATE: print("test_repo_heads:", repo_slug, ": head_passes_tests : started") try: - repo = Repository(repo_slug, cache_directory=cache) + repo = Repository( + repo_slug, + cache_directory=cache, + workdir_id="head-" + repo_info["head hash"], + ) except FileNotFoundError as e: print("test_repo_heads:", repo_slug, ": head_passes_tests :", e) return TEST_STATE.Git_checkout_failed diff --git a/src/scripts/merge_tools/resolve-adjacent-conflicts b/src/scripts/merge_tools/resolve-adjacent-conflicts index 5ae3800f59..0f867916be 100755 --- a/src/scripts/merge_tools/resolve-adjacent-conflicts +++ b/src/scripts/merge_tools/resolve-adjacent-conflicts @@ -32,7 +32,7 @@ # kdiff3 --auto --cs "ShowInfoDialogs=0" base.txt parent1.txt parent2.txt -o merged.txt # Also, the `--auto` option is ignored for folder comparison. -DEBUG=1 +DEBUG=0 if [ "$#" -eq 0 ] ; then readarray -t files < <(grep -l -r '^<<<<<<< HEAD' .)