summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/gl_objects/issues.rst4
-rw-r--r--gitlab/v4/objects.py18
-rw-r--r--tools/python_test_v4.py2
3 files changed, 24 insertions, 0 deletions
diff --git a/docs/gl_objects/issues.rst b/docs/gl_objects/issues.rst
index 12df90b..6823da0 100644
--- a/docs/gl_objects/issues.rst
+++ b/docs/gl_objects/issues.rst
@@ -180,6 +180,10 @@ Get the list of merge requests that will close an issue when merged::
mrs = issue.closed_by()
+Get the merge requests related to an issue::
+
+ mrs = issue.related_merge_requests()
+
Get the list of participants::
users = issue.participants()
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index 9a76d8d..f452aa7 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -2188,6 +2188,24 @@ class ProjectIssue(
@cli.register_custom_action("ProjectIssue")
@exc.on_http_error(exc.GitlabGetError)
+ def related_merge_requests(self, **kwargs):
+ """List merge requests related to the issue.
+
+ Args:
+ **kwargs: Extra options to send to the server (e.g. sudo)
+
+ Raises:
+ GitlabAuthenticationError: If authentication is not correct
+ GitlabGetErrot: If the merge requests could not be retrieved
+
+ Returns:
+ list: The list of merge requests.
+ """
+ path = "%s/%s/related_merge_requests" % (self.manager.path, self.get_id())
+ return self.manager.gitlab.http_get(path, **kwargs)
+
+ @cli.register_custom_action("ProjectIssue")
+ @exc.on_http_error(exc.GitlabGetError)
def closed_by(self, **kwargs):
"""List merge requests that will close the issue when merged.
diff --git a/tools/python_test_v4.py b/tools/python_test_v4.py
index 07f3589..358f2e4 100644
--- a/tools/python_test_v4.py
+++ b/tools/python_test_v4.py
@@ -566,6 +566,8 @@ assert isinstance(issue1.user_agent_detail(), dict)
assert issue1.user_agent_detail()["user_agent"]
assert issue1.participants()
+assert type(issue1.closed_by()) == list
+assert type(issue1.related_merge_requests()) == list
# issues labels and events
label2 = admin_project.labels.create({"name": "label2", "color": "#aabbcc"})