Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitea5d358

Browse files
committed
chore(api): turn changelog into its own manager
1 parent51b6de1 commitea5d358

File tree

3 files changed

+24
-19
lines changed

3 files changed

+24
-19
lines changed

‎gitlab/v4/objects/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
from .projectsimport*
5858
from .push_rulesimport*
5959
from .releasesimport*
60+
from .repositoriesimport*
6061
from .runnersimport*
6162
from .servicesimport*
6263
from .settingsimport*

‎gitlab/v4/objects/projects.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,11 @@
4747
)
4848
from .push_rulesimportProjectPushRulesManager
4949
from .releasesimportProjectReleaseManager
50-
from .repositoriesimportRepositoryMixin
50+
from .repositoriesimport (
51+
RepositoryMixin,
52+
ProjectRepositoryChangelog,
53+
ProjectRepositoryChangelogManager,
54+
)
5155
from .runnersimportProjectRunnerManager
5256
from .servicesimportProjectServiceManager
5357
from .snippetsimportProjectSnippetManager
@@ -112,6 +116,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO
112116
("boards","ProjectBoardManager"),
113117
("branches","ProjectBranchManager"),
114118
("jobs","ProjectJobManager"),
119+
("changelogs","ProjectRepositoryChangelogManager"),
115120
("commits","ProjectCommitManager"),
116121
("customattributes","ProjectCustomAttributeManager"),
117122
("deployments","ProjectDeploymentManager"),

‎gitlab/v4/objects/repositories.py

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66

77
fromgitlabimportcli,types,utils
88
fromgitlabimportexceptionsasexc
9+
fromgitlab.baseimportRESTManager,RESTObject
10+
fromgitlab.mixinsimportCreateMixin
11+
12+
__all__= [
13+
"ProjectRepositoryChangelog",
14+
"ProjectRepositoryChangelogManager",
15+
]
916

1017

1118
classRepositoryMixin:
@@ -205,24 +212,16 @@ def delete_merged_branches(self, **kwargs):
205212
path="/projects/%s/repository/merged_branches"%self.get_id()
206213
self.manager.gitlab.http_delete(path,**kwargs)
207214

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-
defchangelog(self,data=None,**kwargs):
215-
"""Create a changelog entry in the repository.
216215

217-
Args:
218-
**kwargs: Extra options to send to the server (e.g. sudo)
216+
classProjectRepositoryChangelog(RESTObject):
217+
pass
219218

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()
225219

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+
classProjectRepositoryChangelogManager(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

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp