Repository navigation
Add check_merge_conflicts.py to simulate dependencies.yaml merges bef… - #270
Zubair Maalick (zmaalick) wants to merge 4 commits into
Conversation
- Run the release check before simulating. A branch failing it is reported as fail-release but not merged, so later steps, the pairwise table and the merge-order search are checked without it, as they would be once it is removed or rebased. Previously its newer upstream changes were merged in and later branches were reported as conflicting with them. - Only apply the release check with --resolver rules: the legacy get_git_sources.py has no release check, so drift is a warning there. - Fetch each entry straight into its ref instead of reading FETCH_HEAD, which concurrent runs sharing the cache could overwrite. - Fail early with a clear message if git is older than 2.38. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Closing this in favour of #269. This PR added check_merge_conflicts.py, a stand-alone tool that simulated the dependencies.yaml merges with git merge-tree. While reviewing it, we found that simulating the merge separately from the real extract creates two copies of the merge logic, and they disagree. The conflict rules and release check had to be duplicated from get_git_sources.py, the tool couldn't use the local mirrors, and in one case it blamed later branches for conflicts caused by an earlier branch that the real extract would have rejected. #269 now does the same job by reusing the extract's own merge code: merge_sources.py --check runs the real merge in a scratch directory before a suite is submitted. It reports every problem in one run: branches that can't be fetched, branches based on a different release, and branches with unresolved conflicts. It exits 1 if any are found. |
Add check_merge_conflicts.py to simulate dependencies.yaml merges before extracting
PR Summary
Sci/Tech Reviewer:
Code Reviewer:
Adds
github_scripts/check_merge_conflicts.py, a pre-flight check that simulates thedependencies.yamlmerges done bymerge_sources.py/get_git_sources.pyusinggit merge-tree, without a working copy or compile, so conflicts are found in seconds before a suite is submitted.For each repository it reports which branches have drifted onto newer releases than the base, the merge step where the extract would fail, the conflicting files by type (code/housekeeping/other) and which branch they clash with, and a suggested merge order.
By default it models the per-file
CONFLICT_RULESresolution from #269 (--resolver legacymodels the currentCONFLICT_IGNORESbehaviour). Exit status is 0 if the extract would succeed, 1 if it would fail or a branch has drifted, and 2 on errors.Tested with 4 new unit tests on local repos, and against u-ed285 and o-ab147, where it reproduced the real extract failures (same failing step and files).
`
Once merged, we can add this script in
rose-suite.confas:[file:bin/check_merge_conflicts.py]
source=git:localmirrors:MetOffice/SimSys_Scripts.git::github_scripts/check_merge_conflicts.py::main
`
Code Quality Checklist
Testing
Security Considerations
AI Assistance and Attribution
Sci/Tech Review
(Please alert the code reviewer via a tag when you have approved the SR)
Code Review