Skip to content

Commit 412e2bc

Browse files
author
Gauvain Pocentek
committed
1 parent 547f385 commit 412e2bc

File tree

2 files changed

+34
-15
lines changed

2 files changed

+34
-15
lines changed

gitlab/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ class Gitlab(object):
7777
branches
7878
project_commits (ProjectCommitManager): Manager for GitLab projects
7979
commits
80+
project_commitcomments (ProjectCommitCommentManager): Manager for
81+
GitLab projects commits comments
8082
project_keys (ProjectKeyManager): Manager for GitLab projects keys
8183
project_events (ProjectEventManager): Manager for GitLab projects
8284
events
@@ -143,6 +145,7 @@ def __init__(self, url, private_token=None, email=None, password=None,
143145
self.licenses = LicenseManager(self)
144146
self.project_branches = ProjectBranchManager(self)
145147
self.project_commits = ProjectCommitManager(self)
148+
self.project_commit_comments = ProjectCommitCommentManager(self)
146149
self.project_keys = ProjectKeyManager(self)
147150
self.project_events = ProjectEventManager(self)
148151
self.project_forks = ProjectForkManager(self)

gitlab/objects.py

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -838,13 +838,44 @@ class ProjectBuildManager(BaseManager):
838838
obj_cls = ProjectBuild
839839

840840

841+
class ProjectCommitStatus(GitlabObject):
842+
_url = '/projects/%(project_id)s/statuses/%(commit_id)s'
843+
canUpdate = False
844+
canDelete = False
845+
requiredUrlAttrs = ['project_id', 'commit_id']
846+
optionalGetAttrs = ['ref_name', 'stage', 'name', 'all']
847+
requiredCreateAttrs = ['state']
848+
optionalCreateAttrs = ['description', 'name', 'context', 'ref',
849+
'target_url']
850+
851+
852+
class ProjectCommitStatusManager(BaseManager):
853+
obj_cls = ProjectCommitStatus
854+
855+
856+
class ProjectCommitComment(GitlabObject):
857+
_url = '/projects/%(project_id)s/repository/commits/%(commit_id)s/comments'
858+
canUpdate = False
859+
cantGet = False
860+
canDelete = False
861+
requiredUrlAttrs = ['project_id', 'commit_id']
862+
requiredCreateAttrs = ['note']
863+
optionalCreateAttrs = ['path', 'line', 'line_type']
864+
865+
866+
class ProjectCommitCommentManager(BaseManager):
867+
obj_cls = ProjectCommitComment
868+
869+
841870
class ProjectCommit(GitlabObject):
842871
_url = '/projects/%(project_id)s/repository/commits'
843872
canDelete = False
844873
canUpdate = False
845874
canCreate = False
846875
requiredUrlAttrs = ['project_id']
847876
shortPrintAttr = 'title'
877+
managers = [('comments', ProjectCommitCommentManager,
878+
[('project_id', 'project_id'), ('commit_id', 'id')])]
848879

849880
def diff(self, **kwargs):
850881
"""Generate the commit diff."""
@@ -904,21 +935,6 @@ class ProjectCommitManager(BaseManager):
904935
obj_cls = ProjectCommit
905936

906937

907-
class ProjectCommitStatus(GitlabObject):
908-
_url = '/projects/%(project_id)s/statuses/%(commit_id)s'
909-
canUpdate = False
910-
canDelete = False
911-
requiredUrlAttrs = ['project_id', 'commit_id']
912-
optionalGetAttrs = ['ref_name', 'stage', 'name', 'all']
913-
requiredCreateAttrs = ['state']
914-
optionalCreateAttrs = ['description', 'name', 'context', 'ref',
915-
'target_url']
916-
917-
918-
class ProjectCommitStatusManager(BaseManager):
919-
obj_cls = ProjectCommitStatus
920-
921-
922938
class ProjectKey(GitlabObject):
923939
_url = '/projects/%(project_id)s/keys'
924940
canUpdate = False

0 commit comments

Comments
 (0)