Skip to content

Commit 08f19b3

Browse files
author
Gauvain Pocentek
committed
Add support for MR participants API
Fixes python-gitlab#387
1 parent 638da69 commit 08f19b3

File tree

2 files changed

+30
-0
lines changed

2 files changed

+30
-0
lines changed

gitlab/v4/objects.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1557,6 +1557,30 @@ def merge(self, merge_commit_message=None,
15571557
**kwargs)
15581558
self._update_attrs(server_data)
15591559

1560+
@cli.register_custom_action('ProjectMergeRequest')
1561+
@exc.on_http_error(exc.GitlabListError)
1562+
def participants(self, **kwargs):
1563+
"""List the merge request participants.
1564+
1565+
Args:
1566+
all (bool): If True, return all the items, without pagination
1567+
per_page (int): Number of items to retrieve per request
1568+
page (int): ID of the page to return (starts with page 1)
1569+
as_list (bool): If set to False and no pagination option is
1570+
defined, return a generator instead of a list
1571+
**kwargs: Extra options to send to the server (e.g. sudo)
1572+
1573+
Raises:
1574+
GitlabAuthenticationError: If authentication is not correct
1575+
GitlabListError: If the list could not be retrieved
1576+
1577+
Returns:
1578+
RESTObjectList: The list of participants
1579+
"""
1580+
1581+
path = '%s/%s/participants' % (self.manager.path, self.get_id())
1582+
return self.manager.gitlab.http_get(path, **kwargs)
1583+
15601584

15611585
class ProjectMergeRequestManager(CRUDMixin, RESTManager):
15621586
_path = '/projects/%(project_id)s/merge_requests'

tools/python_test_v4.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,12 @@
527527
mr = admin_project.mergerequests.create({'source_branch': 'branch1',
528528
'target_branch': 'master',
529529
'title': 'MR readme2'})
530+
531+
# basic testing: only make sure that the methods exist
532+
mr.commits()
533+
mr.changes()
534+
#mr.participants() # not yet available
535+
530536
mr.merge()
531537
admin_project.branches.delete('branch1')
532538

0 commit comments

Comments
 (0)