Skip to content

Commit

Permalink
Add --dont_check_fingerprints command-line argument
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed May 4, 2024
1 parent e4b6c90 commit fb3842e
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 8 deletions.
18 changes: 13 additions & 5 deletions src/python/replay_merge.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,9 @@ def merge_replay(

if (WORKDIR_DIRECTORY / workdir).exists():
# Ask the user if they want to delete the workdir
print(
f"workdir {workdir} already exists. Do you want to delete it? (y/n)"
answer = input(
f"workdir {workdir} exists. Delete it (n=reuse it)? (y/n)"
)
answer = input()
if answer == "y":
shutil.rmtree(WORKDIR_DIRECTORY / workdir)
else:
Expand Down Expand Up @@ -107,7 +106,10 @@ def merge_replay(
log_path,
repo.local_repo_path,
]
if merge_data[f"{merge_tool.name}_merge_fingerprint"] != merge_fingerprint:
if (
merge_data[f"{merge_tool.name}_merge_fingerprint"] != merge_fingerprint
and not arguments.dont_check_fingerprints
):
raise Exception(
f"fingerprints differ: after merge of {workdir} with {merge_tool}, found"
+ f" {merge_fingerprint} but expected "
Expand Down Expand Up @@ -170,7 +172,7 @@ def merge_replay(
"--merges_csv",
help="CSV file with merges that have been tested",
type=str,
default="results/small/result.csv",
default="results/combined/result.csv",
)
parser.add_argument(
"--idx",
Expand All @@ -183,6 +185,12 @@ def merge_replay(
help="Test the replay of a merge",
action="store_true",
)
parser.add_argument(
"--dont_check_fingerprints",
help="Don't check the fingerprint of a merge",
default=False,
action="store_true",
)
arguments = parser.parse_args()

# Setup for imports
Expand Down
17 changes: 14 additions & 3 deletions src/python/select_from_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
Here are example invocations:
select_from_results.py '(gitmerge_ort == "Merge_failed") and (spork != "Merge_failed")'
select_from_results.py '(gitmerge_ort == "Merge_failed") != (spork == "Merge_failed")'
The resulting .csv is useful for manual examination but cannot be passed to `replay_merge.py` because that requires a .csv file with all tools and all fingerprints.
"""

import argparse
Expand All @@ -30,8 +32,7 @@ def columns_in_query(query):
result.remove("and")
while "or" in result:
result.remove("or")
with_fingerprints = [x for col in result for x in [col, col + "_merge_fingerprint"]]
return with_fingerprints
return result


# Testing:
Expand Down Expand Up @@ -63,7 +64,17 @@ def main():

# Select some columns
columns_to_select = (
["idx", "repo-idx", "merge-idx", "branch_name", "merge", "left", "right"]
[
"idx",
"repo-idx",
"merge-idx",
"branch_name",
"merge",
"left",
"left_tree_fingerprint",
"right",
"right_tree_fingerprint",
]
+ columns_in_query(args.query)
+ args.columns
+ ["repository"]
Expand Down

0 comments on commit fb3842e

Please sign in to comment.