Skip to content

Commit

Permalink
chore: add and document optional parameters for get MR
Browse files Browse the repository at this point in the history
Add and document (some of the) optional parameters that can be done
for a `project.merge_requests.get()`

Closes #1775
  • Loading branch information
JohnVillalovos committed Dec 23, 2021
1 parent ee3f865 commit bfa3dbe
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions docs/gl_objects/merge_requests.rst
Expand Up @@ -186,6 +186,14 @@ Attempt to rebase an MR::

mr.rebase()

Get status of a rebase for an MR::

mr = project.mergerequests.get(mr_id, include_rebase_in_progress=True)
print(mr.rebase_in_progress, mr.merge_error)

For more info see:
https://docs.gitlab.com/ee/api/merge_requests.html#rebase-a-merge-request

Attempt to merge changes between source and target branch::

response = mr.merge_ref()
Expand Down
5 changes: 5 additions & 0 deletions gitlab/v4/objects/merge_requests.py
Expand Up @@ -396,6 +396,11 @@ class ProjectMergeRequestManager(CRUDMixin, RESTManager):
_path = "/projects/{project_id}/merge_requests"
_obj_cls = ProjectMergeRequest
_from_parent_attrs = {"project_id": "id"}
_optional_get_attrs = (
"render_html",
"include_diverged_commits_count",
"include_rebase_in_progress",
)
_create_attrs = RequiredOptional(
required=("source_branch", "target_branch", "title"),
optional=(
Expand Down

0 comments on commit bfa3dbe

Please sign in to comment.