diff options
-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' |