Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc9aedf2

Browse files
author
Gauvain Pocentek
committed
Implement Gitlab 6.1 new methods
- Project: tree, blob - ProjectCommit: diff, blob
1 parent4006ab2 commitc9aedf2

File tree

3 files changed

+39
-1
lines changed

3 files changed

+39
-1
lines changed

‎ChangeLog

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Version 0.4
33
* Fix strings encoding (Closes #6)
44
* Allow to get a project commit (GitLab 6.1)
55
* ProjectMergeRequest: fix Note() method
6+
* Gitlab 6.1 methods: diff, blob (commit), tree, blob (project)
67

78
Version 0.3
89

‎gitlab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def do_get(cls, d):
169169
die("%s objects can't be retrieved"%what)
170170

171171
id=None
172-
ifclsnotin [gitlab.CurrentUser]:
172+
ifclsnotin [gitlab.CurrentUser,gitlab.ProjectCommitDiff]:
173173
id=get_id()
174174

175175
try:

‎gitlab.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,25 @@ class ProjectCommit(GitlabObject):
651651
requiredListAttrs= ['project_id']
652652
shortPrintAttr='title'
653653

654+
defdiff(self):
655+
url='/projects/%(project_id)s/repository/commits/%(commit_id)s/diff'% \
656+
{'project_id':self.project_id,'commit_id':self.id}
657+
r=self.gitlab.rawGet(url)
658+
ifr.status_code==200:
659+
returnr.json()
660+
661+
raiseGitlabGetError()
662+
663+
defblob(self,filepath):
664+
url='/projects/%(project_id)s/repository/blobs/%(commit_id)s'% \
665+
{'project_id':self.project_id,'commit_id':self.id}
666+
url+='?filepath=%s'%filepath
667+
r=self.gitlab.rawGet(url)
668+
ifr.status_code==200:
669+
returnr.content
670+
671+
raiseGitlabGetError()
672+
654673

655674
classProjectKey(GitlabObject):
656675
_url='/projects/%(project_id)s/keys'
@@ -865,6 +884,24 @@ def Tag(self, id=None, **kwargs):
865884
project_id=self.id,
866885
**kwargs)
867886

887+
deftree(self,path='',ref_name=''):
888+
url="%s/%s/repository/tree"% (self._url,self.id)
889+
url+='?path=%s&ref_name=%s'% (path,ref_name)
890+
r=self.gitlab.rawGet(url)
891+
ifr.status_code==200:
892+
returnr.json()
893+
894+
raiseGitlabGetError()
895+
896+
defblob(self,sha,filepath):
897+
url="%s/%s/repository/blobs/%s"% (self._url,self.id,sha)
898+
url+='?filepath=%s'% (filepath)
899+
r=self.gitlab.rawGet(url)
900+
ifr.status_code==200:
901+
returnr.content
902+
903+
raiseGitlabGetError()
904+
868905

869906
classTeamMember(GitlabObject):
870907
_url='/user_teams/%(team_id)s/members'

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp