summaryrefslogtreecommitdiff
path: root/gitlab/objects.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2016-06-19 19:06:54 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2016-06-19 19:06:54 +0200
commit412e2bc7e00a5229974388f795caefa1f0896273 (patch)
treee590feb9316434e4411cc2be48b245d4f7ab0bab /gitlab/objects.py
parent547f38501177a8d67d35e0d55ca0f2dff38f2904 (diff)
downloadgitlab-412e2bc7e00a5229974388f795caefa1f0896273.tar.gz
Add support for commit comments
https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/commits.md
Diffstat (limited to 'gitlab/objects.py')
-rw-r--r--gitlab/objects.py46
1 files changed, 31 insertions, 15 deletions
diff --git a/gitlab/objects.py b/gitlab/objects.py
index 4be5574..7bba1c9 100644
--- a/gitlab/objects.py
+++ b/gitlab/objects.py
@@ -838,6 +838,35 @@ class ProjectBuildManager(BaseManager):
obj_cls = ProjectBuild
+class ProjectCommitStatus(GitlabObject):
+ _url = '/projects/%(project_id)s/statuses/%(commit_id)s'
+ canUpdate = False
+ canDelete = False
+ requiredUrlAttrs = ['project_id', 'commit_id']
+ optionalGetAttrs = ['ref_name', 'stage', 'name', 'all']
+ requiredCreateAttrs = ['state']
+ optionalCreateAttrs = ['description', 'name', 'context', 'ref',
+ 'target_url']
+
+
+class ProjectCommitStatusManager(BaseManager):
+ obj_cls = ProjectCommitStatus
+
+
+class ProjectCommitComment(GitlabObject):
+ _url = '/projects/%(project_id)s/repository/commits/%(commit_id)s/comments'
+ canUpdate = False
+ cantGet = False
+ canDelete = False
+ requiredUrlAttrs = ['project_id', 'commit_id']
+ requiredCreateAttrs = ['note']
+ optionalCreateAttrs = ['path', 'line', 'line_type']
+
+
+class ProjectCommitCommentManager(BaseManager):
+ obj_cls = ProjectCommitComment
+
+
class ProjectCommit(GitlabObject):
_url = '/projects/%(project_id)s/repository/commits'
canDelete = False
@@ -845,6 +874,8 @@ class ProjectCommit(GitlabObject):
canCreate = False
requiredUrlAttrs = ['project_id']
shortPrintAttr = 'title'
+ managers = [('comments', ProjectCommitCommentManager,
+ [('project_id', 'project_id'), ('commit_id', 'id')])]
def diff(self, **kwargs):
"""Generate the commit diff."""
@@ -904,21 +935,6 @@ class ProjectCommitManager(BaseManager):
obj_cls = ProjectCommit
-class ProjectCommitStatus(GitlabObject):
- _url = '/projects/%(project_id)s/statuses/%(commit_id)s'
- canUpdate = False
- canDelete = False
- requiredUrlAttrs = ['project_id', 'commit_id']
- optionalGetAttrs = ['ref_name', 'stage', 'name', 'all']
- requiredCreateAttrs = ['state']
- optionalCreateAttrs = ['description', 'name', 'context', 'ref',
- 'target_url']
-
-
-class ProjectCommitStatusManager(BaseManager):
- obj_cls = ProjectCommitStatus
-
-
class ProjectKey(GitlabObject):
_url = '/projects/%(project_id)s/keys'
canUpdate = False