Skip to content

Commit ebd6217

Browse files
author
Gauvain Pocentek
committed
Add support for Project.pull_mirror (EE)
1 parent f4c4e52 commit ebd6217

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

docs/gl_objects/projects.rst

+5-1
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ Get a list of users for the repository::
193193
# search for users
194194
users = p.users.list(search='pattern')
195195

196+
Start the pull mirroring process (EE edition)::
197+
198+
project.mirror_pull()
199+
196200
Import / Export
197201
===============
198202

@@ -331,7 +335,7 @@ Update a file. The entire content must be uploaded, as plain text or as base64
331335
encoded text::
332336

333337
f.content = 'new content'
334-
f.save(branch='master', commit_message='Update testfile')
338+
f.save(branch='master', commit_message='Update testfile')
335339

336340
# or for binary data
337341
# Note: decode() is required with python 3 for data serialization. You can omit

gitlab/v4/objects.py

+15
Original file line numberDiff line numberDiff line change
@@ -3357,6 +3357,21 @@ def search(self, scope, search, **kwargs):
33573357
path = '/projects/%d/search' % self.get_id()
33583358
return self.manager.gitlab.http_list(path, query_data=data, **kwargs)
33593359

3360+
@cli.register_custom_action('Project')
3361+
@exc.on_http_error(exc.GitlabCreateError)
3362+
def mirror_pull(self, **kwargs):
3363+
"""Start the pull mirroring process for the project.
3364+
3365+
Args:
3366+
**kwargs: Extra options to send to the server (e.g. sudo)
3367+
3368+
Raises:
3369+
GitlabAuthenticationError: If authentication is not correct
3370+
GitlabCreateError: If the server failed to perform the request
3371+
"""
3372+
path = '/projects/%d/mirror/pull' % self.get_id()
3373+
return self.manager.gitlab.http_post(path, **kwargs)
3374+
33603375

33613376
class ProjectManager(CRUDMixin, RESTManager):
33623377
_path = '/projects'

0 commit comments

Comments
 (0)