|
6 | 6 |
|
7 | 7 | from gitlab import cli, types, utils
|
8 | 8 | from gitlab import exceptions as exc
|
| 9 | +from gitlab.base import RESTManager, RESTObject |
| 10 | +from gitlab.mixins import CreateMixin |
| 11 | + |
| 12 | +__all__ = [ |
| 13 | + "ProjectRepositoryChangelog", |
| 14 | + "ProjectRepositoryChangelogManager", |
| 15 | +] |
9 | 16 |
|
10 | 17 |
|
11 | 18 | class RepositoryMixin:
|
@@ -205,24 +212,16 @@ def delete_merged_branches(self, **kwargs):
|
205 | 212 | path = "/projects/%s/repository/merged_branches" % self.get_id()
|
206 | 213 | self.manager.gitlab.http_delete(path, **kwargs)
|
207 | 214 |
|
208 |
| - @cli.register_custom_action( |
209 |
| - "Project", |
210 |
| - ("version_tag",), |
211 |
| - ("from", "to", "date", "branch", "trailer", "file", "message"), |
212 |
| - ) |
213 |
| - @exc.on_http_error(exc.GitlabCreateError) |
214 |
| - def changelog(self, data=None, **kwargs): |
215 |
| - """Create a changelog entry in the repository. |
216 | 215 |
|
217 |
| - Args: |
218 |
| - **kwargs: Extra options to send to the server (e.g. sudo) |
| 216 | +class ProjectRepositoryChangelog(RESTObject): |
| 217 | + pass |
219 | 218 |
|
220 |
| - Raises: |
221 |
| - GitlabAuthenticationError: If authentication is not correct |
222 |
| - GitlabCreateError: If the server failed to perform the request |
223 |
| - """ |
224 |
| - path = "/projects/%s/repository/changelog" % self.get_id() |
225 | 219 |
|
226 |
| - # This is here to avoid clashing with the CLI's `--version` flag |
227 |
| - |
228 |
| - self.manager.gitlab.http_post(path, data=data, **kwargs) |
| 220 | +class ProjectRepositoryChangelogManager(CreateMixin, RESTManager): |
| 221 | + _obj_cls = ProjectRepositoryChangelog |
| 222 | + _path = "/projects/%(project_id)s/repository/changelog" |
| 223 | + _from_parent_attrs = {"project_id": "id"} |
| 224 | + _create_attrs = ( |
| 225 | + ("version",), |
| 226 | + ("from_commit", "to_commit", "date", "branch", "trailer", "file", "message"), |
| 227 | + ) |
0 commit comments