Skip to content

Commit

Permalink
Add support for MR participants API
Browse files Browse the repository at this point in the history
Fixes #387
  • Loading branch information
Gauvain Pocentek committed Jan 20, 2018
1 parent 638da69 commit 08f19b3
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
24 changes: 24 additions & 0 deletions gitlab/v4/objects.py
Expand Up @@ -1557,6 +1557,30 @@ def merge(self, merge_commit_message=None,
**kwargs)
self._update_attrs(server_data)

@cli.register_custom_action('ProjectMergeRequest')
@exc.on_http_error(exc.GitlabListError)
def participants(self, **kwargs):
"""List the merge request participants.
Args:
all (bool): If True, return all the items, without pagination
per_page (int): Number of items to retrieve per request
page (int): ID of the page to return (starts with page 1)
as_list (bool): If set to False and no pagination option is
defined, return a generator instead of a list
**kwargs: Extra options to send to the server (e.g. sudo)
Raises:
GitlabAuthenticationError: If authentication is not correct
GitlabListError: If the list could not be retrieved
Returns:
RESTObjectList: The list of participants
"""

path = '%s/%s/participants' % (self.manager.path, self.get_id())
return self.manager.gitlab.http_get(path, **kwargs)


class ProjectMergeRequestManager(CRUDMixin, RESTManager):
_path = '/projects/%(project_id)s/merge_requests'
Expand Down
6 changes: 6 additions & 0 deletions tools/python_test_v4.py
Expand Up @@ -527,6 +527,12 @@
mr = admin_project.mergerequests.create({'source_branch': 'branch1',
'target_branch': 'master',
'title': 'MR readme2'})

# basic testing: only make sure that the methods exist
mr.commits()
mr.changes()
#mr.participants() # not yet available

mr.merge()
admin_project.branches.delete('branch1')

Expand Down

0 comments on commit 08f19b3

Please sign in to comment.