| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 0814d86 commit 7981987
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -638,7 +638,6 @@ class ProjectBranch(GitlabObject): | |||
| 638 | 638 | canUpdate = False | |
| 639 | 639 | requiredUrlAttrs = ['project_id'] | |
| 640 | 640 | requiredCreateAttrs = ['branch_name', 'ref'] | |
| 641 | - _constructorTypes = {'commit': 'ProjectCommit'} | ||
| 642 | 641 | ||
| 643 | 642 | def protect(self, protect=True, **kwargs): | |
| 644 | 643 | url = self._url % {'project_id': self.project_id} | |
@@ -832,8 +831,23 @@ class ProjectNoteManager(BaseManager): | |||
| 832 | 831 | obj_cls = ProjectNote | |
| 833 | 832 | ||
| 834 | 833 | ||
| 834 | + class ProjectTagRelease(GitlabObject): | ||
| 835 | + _url = '/projects/%(project_id)s/repository/tags/%(tag_name)/release' | ||
| 836 | + canDelete = False | ||
| 837 | + canList = False | ||
| 838 | + requiredUrlAttrs = ['project_id', 'tag_name'] | ||
| 839 | + requiredCreateAttrs = ['description'] | ||
| 840 | + shortPrintAttr = 'description' | ||
| 841 | + | ||
| 842 | + | ||
| 843 | + class ProjectTagReleaseManager(BaseManager): | ||
| 844 | + obj_cls = ProjectTagRelease | ||
| 845 | + | ||
| 846 | + | ||
| 835 | 847 | class ProjectTag(GitlabObject): | |
| 836 | 848 | _url = '/projects/%(project_id)s/repository/tags' | |
| 849 | + _constructorTypes = {'release': 'ProjectTagRelease', | ||
| 850 | + 'commit': 'ProjectCommit'} | ||
| 837 | 851 | idAttr = 'name' | |
| 838 | 852 | canGet = 'from_list' | |
| 839 | 853 | canUpdate = False | |
@@ -842,6 +856,17 @@ class ProjectTag(GitlabObject): | |||
| 842 | 856 | optionalCreateAttrs = ['message'] | |
| 843 | 857 | shortPrintAttr = 'name' | |
| 844 | 858 | ||
| 859 | + def set_release_description(self, description): | ||
| 860 | + url = '/projects/%s/repository/tags/%s/release' % (self.project_id, | ||
| 861 | + self.name) | ||
| 862 | + if self.release is None: | ||
| 863 | + r = self.gitlab._raw_post(url, data={'description': description}) | ||
| 864 | + raise_error_from_response(r, GitlabCreateError, 201) | ||
| 865 | + else: | ||
| 866 | + r = self.gitlab._raw_put(url, data={'description': description}) | ||
| 867 | + raise_error_from_response(r, GitlabUpdateError, 200) | ||
| 868 | + self.release = ProjectTagRelease(self, r.json()) | ||
| 869 | + | ||
| 845 | 870 | ||
| 846 | 871 | class ProjectTagManager(BaseManager): | |
| 847 | 872 | obj_cls = ProjectTag | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -148,4 +148,7 @@ | |||
| 148 | 148 | # tags | |
| 149 | 149 | tag1 = admin_project.tags.create({'tag_name': 'v1.0', 'ref': 'master'}) | |
| 150 | 150 | assert(len(admin_project.tags.list()) == 1) | |
| 151 | + tag1.set_release_description('Description 1') | ||
| 152 | + tag1.set_release_description('Description 2') | ||
| 153 | + assert(tag1.release.description == 'Description 2') | ||
| 151 | 154 | tag1.delete() | |
| Back | FazBrowse Home | New Git URL |
0 commit comments