diff options
author | Max Wittig <max.wittig95@gmail.com> | 2020-03-22 17:48:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-22 17:48:09 +0100 |
commit | 1b8e74887945b363eb46908f2b5f9fa7eb6da40d (patch) | |
tree | b9956d3ad1caa4ba8d13a1279701647dbf60171a /gitlab/v4/objects.py | |
parent | 82deb7dbe261c4b42a9c45a5b85a2c767f3a8218 (diff) | |
parent | da7a809772233be27fa8e563925dd2e44e1ce058 (diff) | |
download | gitlab-1b8e74887945b363eb46908f2b5f9fa7eb6da40d.tar.gz |
Merge pull request #1055 from nejch/feat/commit-gpg-signature
feat: add support for commit GPG signature
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 9da9adf..96327b2 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -2172,6 +2172,24 @@ class ProjectCommit(RESTObject): post_data = {"branch": branch} return self.manager.gitlab.http_post(path, post_data=post_data, **kwargs) + @cli.register_custom_action("ProjectCommit") + @exc.on_http_error(exc.GitlabGetError) + def signature(self, **kwargs): + """Get the GPG signature of the commit. + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabGetError: If the signature could not be retrieved + + Returns: + dict: The commit's GPG signature data + """ + path = "%s/%s/signature" % (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" |