| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4006ab2 commit c9aedf2
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,6 +3,7 @@ Version 0.4 | |||
| 3 | 3 | * Fix strings encoding (Closes #6) | |
| 4 | 4 | * Allow to get a project commit (GitLab 6.1) | |
| 5 | 5 | * ProjectMergeRequest: fix Note() method | |
| 6 | + * Gitlab 6.1 methods: diff, blob (commit), tree, blob (project) | ||
| 6 | 7 | ||
| 7 | 8 | Version 0.3 | |
| 8 | 9 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -169,7 +169,7 @@ def do_get(cls, d): | |||
| 169 | 169 | die("%s objects can't be retrieved" % what) | |
| 170 | 170 | ||
| 171 | 171 | id = None | |
| 172 | - if cls not in [gitlab.CurrentUser]: | ||
| 172 | + if cls not in [gitlab.CurrentUser, gitlab.ProjectCommitDiff]: | ||
| 173 | 173 | id = get_id() | |
| 174 | 174 | ||
| 175 | 175 | try: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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' | |
| Back | FazBrowse Home | New Git URL |
0 commit comments