| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2e5476e commit 1b5c8f1
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -8,7 +8,7 @@ Module contents | |||
| 8 | 8 | :members: | |
| 9 | 9 | :undoc-members: | |
| 10 | 10 | :show-inheritance: | |
| 11 | - :exclude-members: Hook, Project, UserProject, Group, Issue, Team, User, | ||
| 11 | + :exclude-members: Hook, UserProject, Group, Issue, Team, User, | ||
| 12 | 12 | all_projects, owned_projects, search_projects | |
| 13 | 13 | ||
| 14 | 14 | gitlab.exceptions module | |
@@ -27,5 +27,5 @@ gitlab.objects module | |||
| 27 | 27 | :undoc-members: | |
| 28 | 28 | :show-inheritance: | |
| 29 | 29 | :exclude-members: Branch, Commit, Content, Event, File, Hook, Issue, Key, | |
| 30 | - Label, Member, MergeRequest, Milestone, Note, Project, | ||
| 31 | - Snippet, Tag | ||
| 30 | + Label, Member, MergeRequest, Milestone, Note, Snippet, | ||
| 31 | + Tag | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -619,6 +619,16 @@ def Member(self, id=None, **kwargs): | |||
| 619 | 619 | **kwargs) | |
| 620 | 620 | ||
| 621 | 621 | def transfer_project(self, id, **kwargs): | |
| 622 | + """Transfers a project to this new groups. | ||
| 623 | + | ||
| 624 | + Attrs: | ||
| 625 | + id (int): ID of the project to transfer. | ||
| 626 | + | ||
| 627 | + Raises: | ||
| 628 | + GitlabConnectionError: If the server cannot be reached. | ||
| 629 | + GitlabTransferProjectError: If the server fails to perform the | ||
| 630 | + request. | ||
| 631 | + """ | ||
| 622 | 632 | url = '/groups/%d/projects/%d' % (self.id, id) | |
| 623 | 633 | r = self.gitlab._raw_post(url, None, **kwargs) | |
| 624 | 634 | raise_error_from_response(r, GitlabTransferProjectError, 201) | |
@@ -672,6 +682,7 @@ class ProjectBranch(GitlabObject): | |||
| 672 | 682 | requiredCreateAttrs = ['branch_name', 'ref'] | |
| 673 | 683 | ||
| 674 | 684 | def protect(self, protect=True, **kwargs): | |
| 685 | + """Protects the project.""" | ||
| 675 | 686 | url = self._url % {'project_id': self.project_id} | |
| 676 | 687 | action = 'protect' if protect else 'unprotect' | |
| 677 | 688 | url = "%s/%s/%s" % (url, self.name, action) | |
@@ -684,6 +695,7 @@ def protect(self, protect=True, **kwargs): | |||
| 684 | 695 | del self.protected | |
| 685 | 696 | ||
| 686 | 697 | def unprotect(self, **kwargs): | |
| 698 | + """Unprotects the project.""" | ||
| 687 | 699 | self.protect(False, **kwargs) | |
| 688 | 700 | ||
| 689 | 701 | ||
@@ -701,11 +713,13 @@ class ProjectBuild(GitlabObject): | |||
| 701 | 713 | canCreate = False | |
| 702 | 714 | ||
| 703 | 715 | def cancel(self): | |
| 716 | + """Cancel the build.""" | ||
| 704 | 717 | url = '/projects/%s/builds/%s/cancel' % (self.project_id, self.id) | |
| 705 | 718 | r = self.gitlab._raw_post(url) | |
| 706 | 719 | raise_error_from_response(r, GitlabBuildCancelError, 201) | |
| 707 | 720 | ||
| 708 | 721 | def retry(self): | |
| 722 | + """Retry the build.""" | ||
| 709 | 723 | url = '/projects/%s/builds/%s/retry' % (self.project_id, self.id) | |
| 710 | 724 | r = self.gitlab._raw_post(url) | |
| 711 | 725 | raise_error_from_response(r, GitlabBuildRetryError, 201) | |
@@ -724,6 +738,7 @@ class ProjectCommit(GitlabObject): | |||
| 724 | 738 | shortPrintAttr = 'title' | |
| 725 | 739 | ||
| 726 | 740 | def diff(self, **kwargs): | |
| 741 | + """Generate the commit diff.""" | ||
| 727 | 742 | url = ('/projects/%(project_id)s/repository/commits/%(commit_id)s/diff' | |
| 728 | 743 | % {'project_id': self.project_id, 'commit_id': self.id}) | |
| 729 | 744 | r = self.gitlab._raw_get(url, **kwargs) | |
@@ -732,6 +747,18 @@ def diff(self, **kwargs): | |||
| 732 | 747 | return r.json() | |
| 733 | 748 | ||
| 734 | 749 | def blob(self, filepath, **kwargs): | |
| 750 | + """Generate the content of a file for this commit. | ||
| 751 | + | ||
| 752 | + Args: | ||
| 753 | + filepath (str): Path of the file to request. | ||
| 754 | + | ||
| 755 | + Returns: | ||
| 756 | + str: The content of the file | ||
| 757 | + | ||
| 758 | + Raises: | ||
| 759 | + GitlabConnectionError: If the server cannot be reached. | ||
| 760 | + GitlabGetError: If the server fails to perform the request. | ||
| 761 | + """ | ||
| 735 | 762 | url = ('/projects/%(project_id)s/repository/blobs/%(commit_id)s' % | |
| 736 | 763 | {'project_id': self.project_id, 'commit_id': self.id}) | |
| 737 | 764 | url += '?filepath=%s' % filepath | |
@@ -741,6 +768,15 @@ def blob(self, filepath, **kwargs): | |||
| 741 | 768 | return r.content | |
| 742 | 769 | ||
| 743 | 770 | def builds(self, **kwargs): | |
| 771 | + """List the build for this commit. | ||
| 772 | + | ||
| 773 | + Returns: | ||
| 774 | + list(ProjectBuild): A list of builds. | ||
| 775 | + | ||
| 776 | + Raises: | ||
| 777 | + GitlabConnectionError: If the server cannot be reached. | ||
| 778 | + GitlabListError: If the server fails to perform the request. | ||
| 779 | + """ | ||
| 744 | 780 | url = '/projects/%s/repository/commits/%s/builds' % (self.project_id, | |
| 745 | 781 | self.id) | |
| 746 | 782 | r = self.gitlab._raw_get(url, **kwargs) | |
@@ -924,6 +960,19 @@ class ProjectTag(GitlabObject): | |||
| 924 | 960 | shortPrintAttr = 'name' | |
| 925 | 961 | ||
| 926 | 962 | def set_release_description(self, description): | |
| 963 | + """Set the release notes on the tag. | ||
| 964 | + | ||
| 965 | + If the release doesn't exist yet, it will be created. If it already | ||
| 966 | + exists, its description will be updated. | ||
| 967 | + | ||
| 968 | + Args: | ||
| 969 | + description (str): Description of the release. | ||
| 970 | + | ||
| 971 | + Raises: | ||
| 972 | + GitlabConnectionError: If the server cannot be reached. | ||
| 973 | + GitlabCreateError: If the server fails to create the release. | ||
| 974 | + GitlabUpdateError: If the server fails to update the release. | ||
| 975 | + """ | ||
| 927 | 976 | url = '/projects/%s/repository/tags/%s/release' % (self.project_id, | |
| 928 | 977 | self.name) | |
| 929 | 978 | if self.release is None: | |
@@ -1032,7 +1081,7 @@ class ProjectFile(GitlabObject): | |||
| 1032 | 1081 | getRequiresId = False | |
| 1033 | 1082 | ||
| 1034 | 1083 | def decode(self): | |
| 1035 | - """Returns the decoded content. | ||
| 1084 | + """Returns the decoded content of the file. | ||
| 1036 | 1085 | ||
| 1037 | 1086 | Returns: | |
| 1038 | 1087 | (str): the decoded content. | |
@@ -1246,6 +1295,19 @@ def Tag(self, id=None, **kwargs): | |||
| 1246 | 1295 | **kwargs) | |
| 1247 | 1296 | ||
| 1248 | 1297 | def tree(self, path='', ref_name='', **kwargs): | |
| 1298 | + """Return a list of files in the repository. | ||
| 1299 | + | ||
| 1300 | + Args: | ||
| 1301 | + path (str): Path of the top folder (/ by default) | ||
| 1302 | + ref_name (str): Reference to a commit or branch | ||
| 1303 | + | ||
| 1304 | + Returns: | ||
| 1305 | + str: The json representation of the tree. | ||
| 1306 | + | ||
| 1307 | + Raises: | ||
| 1308 | + GitlabConnectionError: If the server cannot be reached. | ||
| 1309 | + GitlabGetError: If the server fails to perform the request. | ||
| 1310 | + """ | ||
| 1249 | 1311 | url = "/projects/%s/repository/tree" % (self.id) | |
| 1250 | 1312 | params = [] | |
| 1251 | 1313 | if path: | |
@@ -1259,13 +1321,38 @@ def tree(self, path='', ref_name='', **kwargs): | |||
| 1259 | 1321 | return r.json() | |
| 1260 | 1322 | ||
| 1261 | 1323 | def blob(self, sha, filepath, **kwargs): | |
| 1324 | + """Return the content of a file for a commit. | ||
| 1325 | + | ||
| 1326 | + Args: | ||
| 1327 | + sha (str): ID of the commit | ||
| 1328 | + filepath (str): Path of the file to return | ||
| 1329 | + | ||
| 1330 | + Returns: | ||
| 1331 | + str: The file content | ||
| 1332 | + | ||
| 1333 | + Raises: | ||
| 1334 | + GitlabConnectionError: If the server cannot be reached. | ||
| 1335 | + GitlabGetError: If the server fails to perform the request. | ||
| 1336 | + """ | ||
| 1262 | 1337 | url = "/projects/%s/repository/blobs/%s" % (self.id, sha) | |
| 1263 | 1338 | url += '?filepath=%s' % (filepath) | |
| 1264 | 1339 | r = self.gitlab._raw_get(url, **kwargs) | |
| 1265 | 1340 | raise_error_from_response(r, GitlabGetError) | |
| 1266 | 1341 | return r.content | |
| 1267 | 1342 | ||
| 1268 | 1343 | def archive(self, sha=None, **kwargs): | |
| 1344 | + """Return a tarball of the repository. | ||
| 1345 | + | ||
| 1346 | + Args: | ||
| 1347 | + sha (str): ID of the commit (default branch by default). | ||
| 1348 | + | ||
| 1349 | + Returns: | ||
| 1350 | + str: The binary data of the archive. | ||
| 1351 | + | ||
| 1352 | + Raises: | ||
| 1353 | + GitlabConnectionError: If the server cannot be reached. | ||
| 1354 | + GitlabGetError: If the server fails to perform the request. | ||
| 1355 | + """ | ||
| 1269 | 1356 | url = '/projects/%s/repository/archive' % self.id | |
| 1270 | 1357 | if sha: | |
| 1271 | 1358 | url += '?sha=%s' % sha | |
| Back | FazBrowse Home | New Git URL |
0 commit comments