diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2018-05-28 07:32:47 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2018-05-28 07:32:47 +0200 |
commit | c19ad90b488edabc47e3a5a5d477a3007eecaa69 (patch) | |
tree | 4b8819adaf38888a2f519d72a1cdfd95ff4aaebf /gitlab/v4/objects.py | |
parent | 3c53f7fb8d9c0f829fbbc87acc7c83590a11b467 (diff) | |
download | gitlab-c19ad90b488edabc47e3a5a5d477a3007eecaa69.tar.gz |
Add commit.merge_requests() support
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r-- | gitlab/v4/objects.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index f18ffdd..df565af 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -1250,6 +1250,24 @@ class ProjectCommit(RESTObject): data = {'type': type} return self.manager.gitlab.http_get(path, query_data=data, **kwargs) + @cli.register_custom_action('ProjectCommit') + @exc.on_http_error(exc.GitlabGetError) + def merge_requests(self, **kwargs): + """List the merge requests related to the commit. + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabGetError: If the references could not be retrieved + + Returns: + list: The merge requests related to the commit. + """ + path = '%s/%s/merge_requests' % (self.manager.path, self.get_id()) + return self.manager.gitlab.http_get(path, **kwargs) + class ProjectCommitManager(RetrieveMixin, CreateMixin, RESTManager): _path = '/projects/%(project_id)s/repository/commits' |