Skip to content

Commit

Permalink
Added ort adjacent merge tool
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt-schesch committed Oct 4, 2023
1 parent 4aafb5c commit 18a69fb
Show file tree
Hide file tree
Showing 12 changed files with 209 additions and 182 deletions.
9 changes: 5 additions & 4 deletions src/python/repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,16 @@
"MERGE_TOOL",
[
"gitmerge_ort",
"gitmerge_ort_adjacent",
"gitmerge_ort_ignorespace",
"gitmerge_recursive_ignorespace",
"gitmerge_ort_imports",
"gitmerge_ort_imports_ignorespace",
"gitmerge_recursive_patience",
"gitmerge_recursive_minimal",
"gitmerge_resolve",
"gitmerge_recursive_histogram",
"gitmerge_recursive_ignorespace",
"gitmerge_recursive_minimal",
"gitmerge_recursive_myers",
"gitmerge_resolve",
"gitmerge_recursive_patience",
"git_hires_merge",
"spork",
"intellimerge",
Expand Down
21 changes: 21 additions & 0 deletions src/scripts/merge_tools/gitmerge_ort_adjacent.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env sh

# usage: ./gitmerge_ort_adjacent.sh <clone_dir> <branch-1> <branch-2>

MERGE_SCRIPTS_DIR="$(cd "$(dirname "$0")" && pwd -P)"
clone_dir=$1
branch1=$2
branch2=$3
strategy="-s ort"
if "$MERGE_SCRIPTS_DIR"/gitmerge.sh "$clone_dir" "$branch1" "$branch2" "$strategy"; then
exit 0
fi

cd "$clone_dir" || exit 1
if ! "$MERGE_SCRIPTS_DIR"/resolve-adjacent-conflicts; then
echo "Conflict"
git merge --abort
exit 1
fi

exit 0
7 changes: 5 additions & 2 deletions test/check_equal_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def remove_run_time(df):
# Print the differences.
print(os.system(f"diff {goal_folder/goal_file} {actual_file}"))
# Now print details, after diffs so it is not obscured by the diff output.
different_columns = []
for col in goal_df.columns:
if "run_time" in col:
raise Exception(
Expand All @@ -55,11 +56,13 @@ def remove_run_time(df):
if not col in actual_df:
print(f"Column {col} is not in actual_df")
print(goal_df[col])
different_columns.append(col)
elif not goal_df[col].equals(actual_df[col]):
print(f"Column {col} is not equal. Printing goal then actual.")
print(goal_df[col])
print(actual_df[col])
print(f"{goal_file} and {actual_file} are not equal")
different_columns.append(col)
print(f"{goal_file} and {actual_file} are not equal in columns: {different_columns}")
# Print the differences
print(os.system(f"diff {goal_folder/goal_file} {actual_file}"))
print(os.system(f"diff {goal_folder/goal_file} {actual_file} in columns: {different_columns}"))
raise ValueError(f"{goal_folder/goal_file} and {actual_file} are not equal")
30 changes: 15 additions & 15 deletions test/small-goal-files/merges_compared/Algorithms.csv

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions test/small-goal-files/merges_compared/JSCover.csv

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions test/small-goal-files/merges_compared/ez-vcard.csv

Large diffs are not rendered by default.

30 changes: 15 additions & 15 deletions test/small-goal-files/merges_tested/Algorithms.csv

Large diffs are not rendered by default.

54 changes: 27 additions & 27 deletions test/small-goal-files/merges_tested/JSCover.csv

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions test/small-goal-files/merges_tested/ez-vcard.csv

Large diffs are not rendered by default.

88 changes: 44 additions & 44 deletions test/small-goal-files/result.csv

Large diffs are not rendered by default.

27 changes: 14 additions & 13 deletions test/small-goal-files/tables/all/table_feature_main_summary.tex
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,18 @@
\multicolumn{2}{c}{Feature Branch} \\
\hline
& \# & \% & \# & \% & \# & \% & \# & \% & \# & \% & \# & \% \\
Gitmerge-ort & 2 & 67\% & 0 & -1\% & 1 & 33\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Gitmerge-ort-ignorespace & 2 & 67\% & 0 & -1\% & 1 & 33\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Gitmerge-recursive-ignorespace & 2 & 67\% & 0 & -1\% & 1 & 33\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Gitmerge-ort-imports & 3 & 100\% & 0 & -1\% & 0 & 0\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Gitmerge-ort-imports-ignorespace & 3 & 100\% & 0 & -1\% & 0 & 0\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Gitmerge-recursive-patience & 2 & 67\% & 0 & -1\% & 1 & 33\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Gitmerge-recursive-minimal & 2 & 67\% & 0 & -1\% & 1 & 33\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Gitmerge-recursive-histogram & 2 & 67\% & 0 & -1\% & 1 & 33\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Gitmerge-recursive-myers & 2 & 67\% & 0 & -1\% & 1 & 33\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Gitmerge-resolve & 2 & 67\% & 0 & -1\% & 1 & 33\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Git-hires-merge & 2 & 67\% & 0 & -1\% & 1 & 33\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
Spork & 3 & 100\% & 0 & -1\% & 0 & 0\% & 0 & -1\% & 0 & 0\% & 0 & -1\% \\
IntelliMerge & 2 & 67\% & 0 & -1\% & 0 & 0\% & 0 & -1\% & 1 & 33\% & 0 & -1\% \\
Gitmerge-ort & 41 & 98\% & 1 & 100\% & 1 & 2\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-ort-adjacent & 42 & 100\% & 1 & 100\% & 0 & 0\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-ort-ignorespace & 41 & 98\% & 1 & 100\% & 1 & 2\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-ort-imports & 42 & 100\% & 1 & 100\% & 0 & 0\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-ort-imports-ignorespace & 42 & 100\% & 1 & 100\% & 0 & 0\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-resolve & 41 & 98\% & 1 & 100\% & 1 & 2\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-recursive-histogram & 41 & 98\% & 1 & 100\% & 1 & 2\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-recursive-ignorespace & 41 & 98\% & 1 & 100\% & 1 & 2\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-recursive-minimal & 41 & 98\% & 1 & 100\% & 1 & 2\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-recursive-myers & 41 & 98\% & 1 & 100\% & 1 & 2\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-recursive-patience & 41 & 98\% & 1 & 100\% & 1 & 2\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Git-hires-merge & 41 & 98\% & 1 & 100\% & 1 & 2\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
Spork & 42 & 100\% & 1 & 100\% & 0 & 0\% & 0 & 0\% & 0 & 0\% & 0 & 0\% \\
IntelliMerge & 41 & 98\% & 1 & 100\% & 0 & 0\% & 0 & 0\% & 1 & 2\% & 0 & 0\% \\
\end{tabular}
27 changes: 14 additions & 13 deletions test/small-goal-files/tables/all/table_summary.tex
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,18 @@
\multicolumn{2}{c}{Incorrect Merges} \\
& \# & \% & \# & \% & \# & \% \\
\hline
Gitmerge-ort & 2 & 67\% & 1 & 33\% & 0 & 0\% \\
Gitmerge-ort-ignorespace & 2 & 67\% & 1 & 33\% & 0 & 0\% \\
Gitmerge-recursive-ignorespace & 2 & 67\% & 1 & 33\% & 0 & 0\% \\
Gitmerge-ort-imports & 3 & 100\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-ort-imports-ignorespace & 3 & 100\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-recursive-patience & 2 & 67\% & 1 & 33\% & 0 & 0\% \\
Gitmerge-recursive-minimal & 2 & 67\% & 1 & 33\% & 0 & 0\% \\
Gitmerge-recursive-histogram & 2 & 67\% & 1 & 33\% & 0 & 0\% \\
Gitmerge-recursive-myers & 2 & 67\% & 1 & 33\% & 0 & 0\% \\
Gitmerge-resolve & 2 & 67\% & 1 & 33\% & 0 & 0\% \\
Git-hires-merge & 2 & 67\% & 1 & 33\% & 0 & 0\% \\
Spork & 3 & 100\% & 0 & 0\% & 0 & 0\% \\
IntelliMerge & 2 & 67\% & 0 & 0\% & 1 & 33\% \\
Gitmerge-ort & 42 & 98\% & 1 & 2\% & 0 & 0\% \\
Gitmerge-ort-adjacent & 43 & 100\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-ort-ignorespace & 42 & 98\% & 1 & 2\% & 0 & 0\% \\
Gitmerge-ort-imports & 43 & 100\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-ort-imports-ignorespace & 43 & 100\% & 0 & 0\% & 0 & 0\% \\
Gitmerge-resolve & 42 & 98\% & 1 & 2\% & 0 & 0\% \\
Gitmerge-recursive-histogram & 42 & 98\% & 1 & 2\% & 0 & 0\% \\
Gitmerge-recursive-ignorespace & 42 & 98\% & 1 & 2\% & 0 & 0\% \\
Gitmerge-recursive-minimal & 42 & 98\% & 1 & 2\% & 0 & 0\% \\
Gitmerge-recursive-myers & 42 & 98\% & 1 & 2\% & 0 & 0\% \\
Gitmerge-recursive-patience & 42 & 98\% & 1 & 2\% & 0 & 0\% \\
Git-hires-merge & 42 & 98\% & 1 & 2\% & 0 & 0\% \\
Spork & 43 & 100\% & 0 & 0\% & 0 & 0\% \\
IntelliMerge & 42 & 98\% & 0 & 0\% & 1 & 2\% \\
\end{tabular}

0 comments on commit 18a69fb

Please sign in to comment.