Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitad1c0dd

Browse files
authored
Merge pull request#803 from python-gitlab/feat/related_mr
feat: add support for issue.related_merge_requests
2 parentsf539c36 +90a3631 commitad1c0dd

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

‎docs/gl_objects/issues.rst

Lines changed: 4 additions & 0 deletions
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()

‎gitlab/v4/objects.py

Lines 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+
defrelated_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+
returnself.manager.gitlab.http_get(path,**kwargs)
2206+
21892207
@cli.register_custom_action("ProjectIssue")
21902208
@exc.on_http_error(exc.GitlabGetError)
21912209
defclosed_by(self,**kwargs):

‎tools/python_test_v4.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,8 @@
566566

567567
assertissue1.user_agent_detail()["user_agent"]
568568
assertissue1.participants()
569+
asserttype(issue1.closed_by())==list
570+
asserttype(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)

[8]ページ先頭

©2009-2025 Movatter.jp