From 180cdbadbcc59c731ec6c8422e48cb3fdbca8122 Mon Sep 17 00:00:00 2001 From: James Bruten <109733895+james-bruten-mo@users.noreply.github.com> Date: Tue, 14 Apr 2026 15:34:58 +0100 Subject: [PATCH 1/3] tweaks to merging --- github_scripts/get_git_sources.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/github_scripts/get_git_sources.py b/github_scripts/get_git_sources.py index ffee9652..9fafefd4 100644 --- a/github_scripts/get_git_sources.py +++ b/github_scripts/get_git_sources.py @@ -5,8 +5,13 @@ # ----------------------------------------------------------------------------- """ Helper functions for cloning git sources in command line builds + +Reads CONFLCIT_IGNORES environment variable to get a list of comma-separated +files/directories to ignore merge conflicts in. These should be relative to the +top-level of the repo. If not set, then a default list is defined below. """ +import os import re import subprocess from datetime import datetime @@ -231,17 +236,24 @@ def handle_merge_conflicts(source: str, ref: str, loc: Path, dependency: str) -> If merge conflicts are in `rose-stem/` or `dependencies.yaml` then accept the current changes and mark as resolved. If others remain then raise an error + If CONFLICT_IGNORES environment variable is set, use that as a comma-separated list + of files/directories to ignore. If not set, use a default list below. """ # For suites, merge conflicts in these files/directories are unimportant so accept # the current changes - for filepath in ("dependencies.yaml", "rose-stem"): + ignores = os.environ.get( + "CONFLICT_IGNORES,dependencies.yaml,rose-stem,CONTRIBUTORS.md" + ).split(",") + need_commit = False + for filepath in ignores: full_path = loc / filepath if not full_path.exists(): continue logger.warning(f"Ignoring merge conflicts in {filepath}") run_command(f"git -C {loc} checkout --ours -- {filepath}") - run_command(f"git -C {loc} add {filepath}") + run_command(f"git -C {loc} add -f {filepath}") + need_commit = True # Check if there are any remaining merge conflicts unmerged = get_unmerged(loc) @@ -254,6 +266,9 @@ def handle_merge_conflicts(source: str, ref: str, loc: Path, dependency: str) -> "\n\nThese will need changing in the source branches to be useable together" ) + if need_commit: + run_command(f"git -C {loc} commit -m 'fix conflict'") + def get_unmerged(loc: Path) -> list[str]: """ From cf4075e61a23787679f0ff27bdca4c92a8388851 Mon Sep 17 00:00:00 2001 From: James Bruten <109733895+james-bruten-mo@users.noreply.github.com> Date: Tue, 14 Apr 2026 15:37:26 +0100 Subject: [PATCH 2/3] fix --- github_scripts/get_git_sources.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/github_scripts/get_git_sources.py b/github_scripts/get_git_sources.py index 9fafefd4..50d73242 100644 --- a/github_scripts/get_git_sources.py +++ b/github_scripts/get_git_sources.py @@ -243,7 +243,7 @@ def handle_merge_conflicts(source: str, ref: str, loc: Path, dependency: str) -> # For suites, merge conflicts in these files/directories are unimportant so accept # the current changes ignores = os.environ.get( - "CONFLICT_IGNORES,dependencies.yaml,rose-stem,CONTRIBUTORS.md" + "CONFLICT_IGNORES", "dependencies.yaml,rose-stem,CONTRIBUTORS.md" ).split(",") need_commit = False for filepath in ignores: From 5075f4e2ea8a7d4021f55cf223e5af8b27868e3f Mon Sep 17 00:00:00 2001 From: James Bruten <109733895+james-bruten-mo@users.noreply.github.com> Date: Tue, 14 Apr 2026 15:38:35 +0100 Subject: [PATCH 3/3] add comment --- github_scripts/get_git_sources.py | 1 + 1 file changed, 1 insertion(+) diff --git a/github_scripts/get_git_sources.py b/github_scripts/get_git_sources.py index 50d73242..463dfbec 100644 --- a/github_scripts/get_git_sources.py +++ b/github_scripts/get_git_sources.py @@ -266,6 +266,7 @@ def handle_merge_conflicts(source: str, ref: str, loc: Path, dependency: str) -> "\n\nThese will need changing in the source branches to be useable together" ) + # Need to commit the ignored conflict fixes if need_commit: run_command(f"git -C {loc} commit -m 'fix conflict'")