From 48642bb5033748f554602dcf1fcb4c358a782f19 Mon Sep 17 00:00:00 2001 From: Benedikt Schesch Date: Sun, 10 Dec 2023 15:49:05 -0800 Subject: [PATCH] Intellimerge full fix --- src/python/delete_intellimerges.py | 21 +++++++++++++++++++++ src/scripts/merge_tools/intellimerge.sh | 5 ++++- 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 src/python/delete_intellimerges.py diff --git a/src/python/delete_intellimerges.py b/src/python/delete_intellimerges.py new file mode 100644 index 0000000000..c72078c584 --- /dev/null +++ b/src/python/delete_intellimerges.py @@ -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) diff --git a/src/scripts/merge_tools/intellimerge.sh b/src/scripts/merge_tools/intellimerge.sh index 9ffe65157e..23f473d206 100755 --- a/src/scripts/merge_tools/intellimerge.sh +++ b/src/scripts/merge_tools/intellimerge.sh @@ -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 @@ -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