Closed
Description
Description of the problem, including code/CLI snippet
I just updated from python-gitlab 2.5.0 to 2.10.1 and noticed that my merge requests do not delete the source branch on merging anymore. I checked the debug output of all the versions in between and found out that the change was introduced in 2.7.0, which silently includes should_remove_source_branch: false
in the merge()
call.
This is undocumented and unexpected behavior. The function should not send a default value. If the value is not explicitly set in the function call, the source branch deletetion should be based on the according setting in the merge request:
This used to be the actual behavior in 2.6.0 and below.
Reproducible example:
#!/usr/bin/env python3
from gitlab import Gitlab
gitlab = Gitlab("https://gitlab.com")
gitlab.enable_debug()
p = gitlab.projects.get(id=278964)
mr = p.mergerequests.get(id=1)
mr.merge()
Expected Behavior
This is the request on python-gitlab 2.6.0:
send: b'PUT /api/v4/projects/278964/merge_requests/1/merge HTTP/1.1\r\nHost: gitlab.com\r\nUser-Agent: python-gitlab/2.6.0\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nContent-Length: 2\r\n\r\n'
send: b'{}'
Actual Behavior
This is the request on python-gitlab >= 2.7.0
send: b'PUT /api/v4/projects/278964/merge_requests/1/merge HTTP/1.1\r\nHost: gitlab.com\r\nUser-Agent: python-gitlab/2.10.1\r\nAccept-Encoding: gzip, deflate\r\nAccept: */*\r\nConnection: keep-alive\r\nContent-type: application/json\r\nContent-Length: 38\r\n\r\n'
send: b'{"should_remove_source_branch": false}'
Specifications
- python-gitlab version: 2.70 - 2.10.1
- API version you are using (v3/v4): v4
- Gitlab server version (or gitlab.com): gitlab.com
Metadata
Metadata
Assignees
Labels
No labels