diff options
author | Gauvain Pocentek <gauvain@pocentek.net> | 2018-06-10 10:13:48 +0200 |
---|---|---|
committer | Gauvain Pocentek <gauvain@pocentek.net> | 2018-06-10 10:13:48 +0200 |
commit | ebd6217853de7e7b6a140bbdf7e8779b5a40b861 (patch) | |
tree | 379e1bd8fc9e918cc94fcc8d373ee9e6869545b8 | |
parent | f4c4e52fd8962638ab79429a49fd4a699048bafc (diff) | |
download | gitlab-ebd6217853de7e7b6a140bbdf7e8779b5a40b861.tar.gz |
Add support for Project.pull_mirror (EE)
-rw-r--r-- | docs/gl_objects/projects.rst | 6 | ||||
-rw-r--r-- | gitlab/v4/objects.py | 15 |
2 files changed, 20 insertions, 1 deletions
diff --git a/docs/gl_objects/projects.rst b/docs/gl_objects/projects.rst index 57d6b76..c6799a2 100644 --- a/docs/gl_objects/projects.rst +++ b/docs/gl_objects/projects.rst @@ -193,6 +193,10 @@ Get a list of users for the repository:: # search for users users = p.users.list(search='pattern') +Start the pull mirroring process (EE edition):: + + project.mirror_pull() + Import / Export =============== @@ -331,7 +335,7 @@ Update a file. The entire content must be uploaded, as plain text or as base64 encoded text:: f.content = 'new content' - f.save(branch='master', commit_message='Update testfile') + f.save(branch='master', commit_message='Update testfile') # or for binary data # Note: decode() is required with python 3 for data serialization. You can omit diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index a034308..609ff14 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -3357,6 +3357,21 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject): path = '/projects/%d/search' % self.get_id() return self.manager.gitlab.http_list(path, query_data=data, **kwargs) + @cli.register_custom_action('Project') + @exc.on_http_error(exc.GitlabCreateError) + def mirror_pull(self, **kwargs): + """Start the pull mirroring process for the project. + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabCreateError: If the server failed to perform the request + """ + path = '/projects/%d/mirror/pull' % self.get_id() + return self.manager.gitlab.http_post(path, **kwargs) + class ProjectManager(CRUDMixin, RESTManager): _path = '/projects' |