summaryrefslogtreecommitdiff
path: root/gitlab
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
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')
-rw-r--r--gitlab/__init__.py3
-rw-r--r--gitlab/objects.py46
2 files changed, 34 insertions, 15 deletions
diff --git a/gitlab/__init__.py b/gitlab/__init__.py
index 1f895e3..a8e0fe6 100644
--- a/gitlab/__init__.py
+++ b/gitlab/__init__.py
@@ -77,6 +77,8 @@ class Gitlab(object):
branches
project_commits (ProjectCommitManager): Manager for GitLab projects
commits
+ project_commitcomments (ProjectCommitCommentManager): Manager for
+ GitLab projects commits comments
project_keys (ProjectKeyManager): Manager for GitLab projects keys
project_events (ProjectEventManager): Manager for GitLab projects
events
@@ -143,6 +145,7 @@ class Gitlab(object):
self.licenses = LicenseManager(self)
self.project_branches = ProjectBranchManager(self)
self.project_commits = ProjectCommitManager(self)
+ self.project_commit_comments = ProjectCommitCommentManager(self)
self.project_keys = ProjectKeyManager(self)
self.project_events = ProjectEventManager(self)
self.project_forks = ProjectForkManager(self)
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