@@ -651,6 +651,25 @@ class ProjectCommit(GitlabObject):
651
651
requiredListAttrs = ['project_id' ]
652
652
shortPrintAttr = 'title'
653
653
654
+ def diff (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
+ if r .status_code == 200 :
659
+ return r .json ()
660
+
661
+ raise GitlabGetError ()
662
+
663
+ def blob (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
+ if r .status_code == 200 :
669
+ return r .content
670
+
671
+ raise GitlabGetError ()
672
+
654
673
655
674
class ProjectKey (GitlabObject ):
656
675
_url = '/projects/%(project_id)s/keys'
@@ -865,6 +884,24 @@ def Tag(self, id=None, **kwargs):
865
884
project_id = self .id ,
866
885
** kwargs )
867
886
887
+ def tree (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
+ if r .status_code == 200 :
892
+ return r .json ()
893
+
894
+ raise GitlabGetError ()
895
+
896
+ def blob (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
+ if r .status_code == 200 :
901
+ return r .content
902
+
903
+ raise GitlabGetError ()
904
+
868
905
869
906
class TeamMember (GitlabObject ):
870
907
_url = '/user_teams/%(team_id)s/members'
0 commit comments