Skip to content

Commit

Permalink
Intellimerge full fix
Browse files Browse the repository at this point in the history
  • Loading branch information
benedikt-schesch committed Dec 10, 2023
1 parent 18aaf2c commit 48642bb
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
21 changes: 21 additions & 0 deletions src/python/delete_intellimerges.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# -*- coding: utf-8 -*-
""" Delete all entries that finish with "intellimerge" in the
cache/sha_cache_entry directory and subdirectories.
"""

import json
from pathlib import Path

base_path = Path("cache/sha_cache_entry")
# Iterate over all json files in the directory and subdirectories
for json_file in base_path.glob("**/*.json"):
# Load json file
with json_file.open() as f:
data = json.load(f)
# Delete all entries that finish with "intellimerge"
for key in list(data.keys()):
if key.endswith("intellimerge"):
del data[key]
# Save json file
with json_file.open("w") as f:
json.dump(data, f)
5 changes: 4 additions & 1 deletion src/scripts/merge_tools/intellimerge.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ java -jar "$intellimerge_absolutepath" -r "$clone_dir" -b "$branch1" "$branch2"
# run git merge
cd "$clone_dir" || exit 1
git checkout "$branch1" --force

initial_conflict_markers=$(grep -rE '^(<<<<<<<|=======|>>>>>>>$)' "$clone_dir" | wc -l)

git merge --no-edit "$branch2"
cd - || exit 1

Expand All @@ -43,7 +46,7 @@ rm -rf $temp_dir

# report conflicts
conflict_markers=$(grep -rE '^(<<<<<<<|=======|>>>>>>>$)' "$clone_dir" | wc -l)
if [ "$conflict_markers" -gt 0 ]; then
if [ "$conflict_markers" -ne "$initial_conflict_markers" ]; then
echo "Conflict detected"
exit 1
fi
Expand Down

0 comments on commit 48642bb

Please sign in to comment.