summaryrefslogtreecommitdiff
path: root/gitlab.py
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2013-09-14 11:55:10 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2013-09-14 11:55:10 +0200
commitc9aedf21464b4c219aac4f46b53d591dc4f1ef16 (patch)
tree2c80d553b9bd688252ad22588ec4b83072ab4e51 /gitlab.py
parent4006ab26ce73d03a8d74cfd978d93117ce8d68d6 (diff)
downloadgitlab-c9aedf21464b4c219aac4f46b53d591dc4f1ef16.tar.gz
Implement Gitlab 6.1 new methods
- Project: tree, blob - ProjectCommit: diff, blob
Diffstat (limited to 'gitlab.py')
-rw-r--r--gitlab.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/gitlab.py b/gitlab.py
index 78af89d..9414fc2 100644
--- a/gitlab.py
+++ b/gitlab.py
@@ -651,6 +651,25 @@ class ProjectCommit(GitlabObject):
requiredListAttrs = ['project_id']
shortPrintAttr = 'title'
+ def diff(self):
+ url = '/projects/%(project_id)s/repository/commits/%(commit_id)s/diff' % \
+ {'project_id': self.project_id, 'commit_id': self.id}
+ r = self.gitlab.rawGet(url)
+ if r.status_code == 200:
+ return r.json()
+
+ raise GitlabGetError()
+
+ def blob(self, filepath):
+ url = '/projects/%(project_id)s/repository/blobs/%(commit_id)s' % \
+ {'project_id': self.project_id, 'commit_id': self.id}
+ url += '?filepath=%s' % filepath
+ r = self.gitlab.rawGet(url)
+ if r.status_code == 200:
+ return r.content
+
+ raise GitlabGetError()
+
class ProjectKey(GitlabObject):
_url = '/projects/%(project_id)s/keys'
@@ -865,6 +884,24 @@ class Project(GitlabObject):
project_id=self.id,
**kwargs)
+ def tree(self, path='', ref_name=''):
+ url = "%s/%s/repository/tree" % (self._url, self.id)
+ url += '?path=%s&ref_name=%s' % (path, ref_name)
+ r = self.gitlab.rawGet(url)
+ if r.status_code == 200:
+ return r.json()
+
+ raise GitlabGetError()
+
+ def blob(self, sha, filepath):
+ url = "%s/%s/repository/blobs/%s" % (self._url, self.id, sha)
+ url += '?filepath=%s' % (filepath)
+ r = self.gitlab.rawGet(url)
+ if r.status_code == 200:
+ return r.content
+
+ raise GitlabGetError()
+
class TeamMember(GitlabObject):
_url = '/user_teams/%(team_id)s/members'