Unanticipated ApiError from GitLab on merge attempt (while it is anticipated)
## Prerequisites While marge is waiting for pipeline to pass, someone skips the queue and updates target branch. ## Expected result Marge notices changes of target branch, **attempts rebase** and, if successful — awaits new pipeline completion (this behaviour broke somewhere between GitLab 14.10 and 15.7, currently we use 16.2) and finally merges it / retries previous step. ## Actual result Marge fails with the following logs and unassigns itself. ```log ERROR Unanticipated ApiError from GitLab on merge attempt Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/marge/gitlab.py", line 29, in call response = self._gitlab.http_request( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/gitlab/client.py", line 779, in http_request raise gitlab.exceptions.GitlabHttpError( gitlab.exceptions.GitlabHttpError: 422: Branch cannot be merged The above exception was the direct cause of the following exception: File "/app/.venv/lib/python3.12/site-packages/marge/merge_request.py", line 292, in accept result = self._api.call( ^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.12/site-packages/marge/gitlab.py", line 54, in call raise errors[code](*err.args) from err marge.gitlab.Unprocessable: Branch cannot be merged Traceback (most recent call last): File "/app/.venv/lib/python3.12/site-packages/marge/single_merge_job.py", line 143, in update_merge_request_and_accept ret = merge_request.accept( ^^^^^^^^^^^^^^^^^^^^^ ```
issue