diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2018-05-28 07:14:58 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2018-05-28 07:14:58 +0200 |
commit | 32569ea27d36c7341b031f11d14f79fd6abd373f (patch) | |
tree | c9e1b8e0b4f8430bfa0fbe0fffcbbd35d7376468 /gitlab/v4/objects.py | |
parent | 63a4c7c95112f6c6aed6e9fa6cf4afd88f0b80e7 (diff) | |
download | gitlab-32569ea27d36c7341b031f11d14f79fd6abd373f.tar.gz |
Implement commit.refs()
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r-- | gitlab/v4/objects.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 46a6fd7..f18ffdd 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -1230,6 +1230,26 @@ class ProjectCommit(RESTObject): post_data = {'branch': branch} self.manager.gitlab.http_post(path, post_data=post_data, **kwargs) + @cli.register_custom_action('ProjectCommit', optional=('type',)) + @exc.on_http_error(exc.GitlabGetError) + def refs(self, type='all', **kwargs): + """List the references the commit is pushed to. + + Args: + type (str): The scope of references ('branch', 'tag' or 'all') + **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 references the commit is pushed to. + """ + path = '%s/%s/refs' % (self.manager.path, self.get_id()) + data = {'type': type} + return self.manager.gitlab.http_get(path, query_data=data, **kwargs) + class ProjectCommitManager(RetrieveMixin, CreateMixin, RESTManager): _path = '/projects/%(project_id)s/repository/commits' |