Skip to content

Handle nonexistent files during pre-release merges

pre_release_merge.py expects all conflicting files in doc/notes/ to exist in both the target branch and the merge request's source branch. If that is not the case, the repo.checkout_file() call in merge_merge_request() raises an exception. Meanwhile, the script should gracefully handle all possible merge conflicts in doc/notes/ because they do not matter from code testing perspective.

Replace the repo.checkout_file() call in merge_merge_request() with a slightly different logic that updates the working copy with the contents of the conflicting file as found in the merge request's source branch when merge conflicts are resolved. If the merge request's source branch does not contain the conflicting file, it will become an empty (yet existent) file in the working copy. This is safer than removing the conflicting file altogether because doc/notes/notes-*.rst files are referenced from doc/arm/notes.rst, so removing them might break the build for the resulting tree, which should be avoided for pre-release branches. Similarly, passing must_exist=False to repo.checkout_file() (followed by calling repo.add_to_index(path)) would leave conflict markers in the file, also potentially breaking the build for the resulting tree.

Merge request reports