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

Commit 90a3631

Browse filesBrowse files
author
Gauvain Pocentek
committed
feat: add support for issue.related_merge_requests
Closes python-gitlab#794
1 parent 51751c5 commit 90a3631
Copy full SHA for 90a3631

File tree

Expand file treeCollapse file tree

3 files changed

+24
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+24
-0
lines changed
Open diff view settings
Collapse file

‎docs/gl_objects/issues.rst‎

Copy file name to clipboardExpand all lines: docs/gl_objects/issues.rst
+4Lines changed: 4 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,10 @@ Get the list of merge requests that will close an issue when merged::
180180

181181
mrs = issue.closed_by()
182182

183+
Get the merge requests related to an issue::
184+
185+
mrs = issue.related_merge_requests()
186+
183187
Get the list of participants::
184188

185189
users = issue.participants()
Collapse file

‎gitlab/v4/objects.py‎

Copy file name to clipboardExpand all lines: gitlab/v4/objects.py
+18Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2186,6 +2186,24 @@ def move(self, to_project_id, **kwargs):
21862186
server_data = self.manager.gitlab.http_post(path, post_data=data, **kwargs)
21872187
self._update_attrs(server_data)
21882188

2189+
@cli.register_custom_action("ProjectIssue")
2190+
@exc.on_http_error(exc.GitlabGetError)
2191+
def related_merge_requests(self, **kwargs):
2192+
"""List merge requests related to the issue.
2193+
2194+
Args:
2195+
**kwargs: Extra options to send to the server (e.g. sudo)
2196+
2197+
Raises:
2198+
GitlabAuthenticationError: If authentication is not correct
2199+
GitlabGetErrot: If the merge requests could not be retrieved
2200+
2201+
Returns:
2202+
list: The list of merge requests.
2203+
"""
2204+
path = "%s/%s/related_merge_requests" % (self.manager.path, self.get_id())
2205+
return self.manager.gitlab.http_get(path, **kwargs)
2206+
21892207
@cli.register_custom_action("ProjectIssue")
21902208
@exc.on_http_error(exc.GitlabGetError)
21912209
def closed_by(self, **kwargs):
Collapse file

‎tools/python_test_v4.py‎

Copy file name to clipboardExpand all lines: tools/python_test_v4.py
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,8 @@
566566

567567
assert issue1.user_agent_detail()["user_agent"]
568568
assert issue1.participants()
569+
assert type(issue1.closed_by()) == list
570+
assert type(issue1.related_merge_requests()) == list
569571

570572
# issues labels and events
571573
label2 = admin_project.labels.create({"name": "label2", "color": "#aabbcc"})

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.