diff --git a/gitlab/cli.py b/gitlab/cli.py index 1e98a3855..af8432afa 100644 --- a/gitlab/cli.py +++ b/gitlab/cli.py @@ -172,7 +172,7 @@ def main(): # otherwise it will cause circular import errors import gitlab.v4.cli - if "--version" in sys.argv: + if "--version" == sys.argv[1]: print(gitlab.__version__) sys.exit(0) diff --git a/gitlab/v4/objects/__init__.py b/gitlab/v4/objects/__init__.py index 8a2ed7c37..9ca0f92fd 100644 --- a/gitlab/v4/objects/__init__.py +++ b/gitlab/v4/objects/__init__.py @@ -57,6 +57,7 @@ from .projects import * from .push_rules import * from .releases import * +from .repositories import * from .runners import * from .services import * from .settings import * diff --git a/gitlab/v4/objects/projects.py b/gitlab/v4/objects/projects.py index c187ba95f..9f601dd79 100644 --- a/gitlab/v4/objects/projects.py +++ b/gitlab/v4/objects/projects.py @@ -47,7 +47,11 @@ ) from .push_rules import ProjectPushRulesManager from .releases import ProjectReleaseManager -from .repositories import RepositoryMixin +from .repositories import ( + RepositoryMixin, + ProjectRepositoryChangelog, + ProjectRepositoryChangelogManager, +) from .runners import ProjectRunnerManager from .services import ProjectServiceManager from .snippets import ProjectSnippetManager @@ -112,6 +116,7 @@ class Project(RefreshMixin, SaveMixin, ObjectDeleteMixin, RepositoryMixin, RESTO ("boards", "ProjectBoardManager"), ("branches", "ProjectBranchManager"), ("jobs", "ProjectJobManager"), + ("changelogs", "ProjectRepositoryChangelogManager"), ("commits", "ProjectCommitManager"), ("customattributes", "ProjectCustomAttributeManager"), ("deployments", "ProjectDeploymentManager"), diff --git a/gitlab/v4/objects/repositories.py b/gitlab/v4/objects/repositories.py index 6a04174b9..1b844f9a8 100644 --- a/gitlab/v4/objects/repositories.py +++ b/gitlab/v4/objects/repositories.py @@ -6,6 +6,13 @@ from gitlab import cli, types, utils from gitlab import exceptions as exc +from gitlab.base import RESTManager, RESTObject +from gitlab.mixins import CreateMixin + +__all__ = [ + "ProjectRepositoryChangelog", + "ProjectRepositoryChangelogManager", +] class RepositoryMixin: @@ -204,3 +211,17 @@ def delete_merged_branches(self, **kwargs): """ path = "/projects/%s/repository/merged_branches" % self.get_id() self.manager.gitlab.http_delete(path, **kwargs) + + +class ProjectRepositoryChangelog(RESTObject): + pass + + +class ProjectRepositoryChangelogManager(CreateMixin, RESTManager): + _obj_cls = ProjectRepositoryChangelog + _path = "/projects/%(project_id)s/repository/changelog" + _from_parent_attrs = {"project_id": "id"} + _create_attrs = ( + ("version",), + ("from_commit", "to_commit", "date", "branch", "trailer", "file", "message"), + )