diff --git a/src/python/replay_merge.py b/src/python/replay_merge.py index 27991cbd16..69c0bbba73 100755 --- a/src/python/replay_merge.py +++ b/src/python/replay_merge.py @@ -1,7 +1,8 @@ #!/usr/bin/env python3 # -*- coding: utf-8 -*- """Replay merges and their test results. -The output appears in the .workdirs/ directory. +The output appears in the `.workdirsf`/ directory. +Logs appear in the `replay_logs/merges/` directory. Command-line arguments are listed just after the line: if __name__ == "__main__": @@ -13,6 +14,7 @@ import argparse import git import os +import os.path import sys import tarfile from pathlib import Path @@ -92,7 +94,22 @@ def merge_replay( plumelib_merging_dir = Path(ast_merging_evaluation_repo.working_tree_dir) / Path( "src/scripts/merge_tools/merging" ) - subprocess.run(["./gradlew", "-q", "shadowJar"], cwd=plumelib_merging_dir) + print(f"About to compile in {plumelib_merging_dir}") + p = subprocess.run( + ["./gradlew", "-q", "shadowJar"], + cwd=plumelib_merging_dir, + capture_output=True, + text=True, + ) + if p.returncode != 0: + print("Failure in: ./gradlew -q shadowJar") + print(p.stdout) + print(p.stderr) + sys.exit(1) + p = subprocess.run( + ["./gradlew", "-q", "nativeCompile"], cwd=plumelib_merging_dir, check=False + ) + print("Finished compiling") result_df = pd.DataFrame() with Progress( @@ -157,6 +174,7 @@ def merge_replay( ["git", "merge-base", merge_data["left"], merge_data["right"]], cwd=repo.local_repo_path, stdout=subprocess.PIPE, + check=True, ) .stdout.decode("utf-8") .strip() diff --git a/src/python/repo.py b/src/python/repo.py index b242a608a7..a514b95d3f 100755 --- a/src/python/repo.py +++ b/src/python/repo.py @@ -568,13 +568,18 @@ def merge( str(timeout), f"src/scripts/merge_tools/{tool.name}.sh {self.local_repo_path.resolve()} {LEFT_BRANCH_NAME} {RIGHT_BRANCH_NAME}", ] + logger.debug( + f"merge: Merging {self.repo_slug} {left_commit} {right_commit} with {tool.name}" + ) p = subprocess.run( command, capture_output=True, check=False, ) + std_streams = stdout_and_stderr(command, p) + logger.debug(std_streams) if p.returncode == 124: # Timeout - explanation = explanation + "\n" + stdout_and_stderr(command, p) + explanation = explanation + "\n" + std_streams if use_cache: cache_entry["merge status"] = MERGE_STATE.Merge_timedout.name cache_entry["explanation"] = explanation @@ -593,7 +598,7 @@ def merge( -1, ) run_time = time.time() - start_time - explanation = explanation + "\n" + stdout_and_stderr(command, p) + explanation = explanation + "\n" + std_streams merge_status = ( MERGE_STATE.Merge_success if p.returncode == 0 else MERGE_STATE.Merge_failed ) diff --git a/src/scripts/merge_tools/merge_git_then_plumelib.sh b/src/scripts/merge_tools/merge_git_then_plumelib.sh index 2edce670c3..fbed920b29 100755 --- a/src/scripts/merge_tools/merge_git_then_plumelib.sh +++ b/src/scripts/merge_tools/merge_git_then_plumelib.sh @@ -59,7 +59,11 @@ fi git config --local merge.tool merge-plumelib # shellcheck disable=SC2016 -git config --local mergetool.merge-plumelib.cmd 'merge-tool.sh '"$plumelib_strategy"' ${BASE} ${LOCAL} ${REMOTE} ${MERGED}' +if [ -n "$VERBOSE" ] ; then + git config --local mergetool.merge-plumelib.cmd 'merge-tool.sh --verbose '"$plumelib_strategy"' ${LOCAL} ${BASE} ${REMOTE} ${MERGED}' +else + git config --local mergetool.merge-plumelib.cmd 'merge-tool.sh '"$plumelib_strategy"' ${LOCAL} ${BASE} ${REMOTE} ${MERGED}' +fi git config --local mergetool.merge-plumelib.trustExitCode true case "$plumelib_strategy" in @@ -76,11 +80,11 @@ esac if [ -n "$VERBOSE" ] ; then echo "$0: about to run: git-mergetool.sh $all_arg --tool=merge-plumelib in $(pwd)" echo "$0: about to run: git-mergetool.sh $all_arg --tool=merge-plumelib in $(pwd)" >&2 -fi -git-mergetool.sh $all_arg --tool=merge-plumelib -if [ -n "$VERBOSE" ] ; then + git-mergetool.sh --verbose $all_arg --tool=merge-plumelib echo "$0: ran: git-mergetool.sh $all_arg --tool=merge-plumelib in $(pwd)" echo "$0: ran: git-mergetool.sh $all_arg --tool=merge-plumelib in $(pwd)" >&2 +else + git-mergetool.sh $all_arg --tool=merge-plumelib fi # Check if there are still conflicts diff --git a/src/scripts/merge_tools/merge_script_then_plumelib.sh b/src/scripts/merge_tools/merge_script_then_plumelib.sh index 42ef792ced..66baae69c1 100755 --- a/src/scripts/merge_tools/merge_script_then_plumelib.sh +++ b/src/scripts/merge_tools/merge_script_then_plumelib.sh @@ -60,7 +60,11 @@ fi git config --local merge.tool merge-plumelib # shellcheck disable=SC2016 -git config --local mergetool.merge-plumelib.cmd 'merge-tool.sh '"$plumelib_strategy"' ${BASE} ${LOCAL} ${REMOTE} ${MERGED}' +if [ -n "$VERBOSE" ] ; then + git config --local mergetool.merge-plumelib.cmd 'merge-tool.sh --verbose '"$plumelib_strategy"' ${LOCAL} ${BASE} ${REMOTE} ${MERGED}' +else + git config --local mergetool.merge-plumelib.cmd 'merge-tool.sh '"$plumelib_strategy"' ${LOCAL} ${BASE} ${REMOTE} ${MERGED}' +fi git config --local mergetool.merge-plumelib.trustExitCode true case "$plumelib_strategy" in diff --git a/src/scripts/merge_tools/merging b/src/scripts/merge_tools/merging index 7d534cf30f..694e1ac7bd 160000 --- a/src/scripts/merge_tools/merging +++ b/src/scripts/merge_tools/merging @@ -1 +1 @@ -Subproject commit 7d534cf30fefb03962385372d7a8125ab97b3aac +Subproject commit 694e1ac7bdb17a2631442405513e748c837a9f3b