Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions 1 gitlab/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def wrapped_f(*args: Any, **kwargs: Any) -> Any:
action = custom_action or f.__name__.replace("_", "-")
custom_actions[final_name][action] = (mandatory, optional, in_obj)

wrapped_f._custom_args = mandatory + optional
return cast(__F, wrapped_f)

return wrap
Expand Down
30 changes: 13 additions & 17 deletions 30 gitlab/v4/objects/merge_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -350,18 +350,15 @@ def merge_ref(self, **kwargs: Any) -> Union[Dict[str, Any], requests.Response]:
(),
(
"merge_commit_message",
"should_remove_source_branch",
"merge_when_pipeline_succeeds",
"sha",
"should_remove_source_branch",
"squash_commit_message",
"squash",
),
)
@exc.on_http_error(exc.GitlabMRClosedError)
def merge(
self,
merge_commit_message: Optional[str] = None,
should_remove_source_branch: Optional[bool] = None,
merge_when_pipeline_succeeds: Optional[bool] = None,
**kwargs: Any,
) -> Dict[str, Any]:
def merge(self, **kwargs: Any) -> Dict[str, Any]:
"""Accept the merge request.

Args:
Expand All @@ -377,15 +374,14 @@ def merge(
GitlabMRClosedError: If the merge failed
"""
path = f"{self.manager.path}/{self.encoded_id}/merge"
data: Dict[str, Any] = {}
if merge_commit_message:
data["merge_commit_message"] = merge_commit_message
if should_remove_source_branch is not None:
data["should_remove_source_branch"] = should_remove_source_branch
if merge_when_pipeline_succeeds is not None:
data["merge_when_pipeline_succeeds"] = merge_when_pipeline_succeeds

server_data = self.manager.gitlab.http_put(path, post_data=data, **kwargs)
post_data: Dict[str, Any] = {}
data = kwargs.copy()

for key in kwargs.keys():
if key in self.merge._custom_args:
post_data[key] = data.pop(key)

server_data = self.manager.gitlab.http_put(path, post_data=post_data, **data)
if TYPE_CHECKING:
assert isinstance(server_data, dict)
self._update_attrs(server_data)
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.