summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gitlab/v4/objects.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py
index 7438655..bd7635f 100644
--- a/gitlab/v4/objects.py
+++ b/gitlab/v4/objects.py
@@ -3611,6 +3611,25 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject):
path = '/projects/%d/mirror/pull' % self.get_id()
self.manager.gitlab.http_post(path, **kwargs)
+ @cli.register_custom_action('Project', ('to_namespace', ))
+ @exc.on_http_error(exc.GitlabTransferProjectError)
+ def transfer_project(self, to_namespace, **kwargs):
+ """Transfer a project to the given namespace ID
+
+ Args:
+ to_namespace (str): ID or path of the namespace to transfer the
+ project to
+ **kwargs: Extra options to send to the server (e.g. sudo)
+
+ Raises:
+ GitlabAuthenticationError: If authentication is not correct
+ GitlabTransferProjectError: If the project could not be transfered
+ """
+ path = '/projects/%d/transfer' % (self.id,)
+ self.manager.gitlab.http_put(path,
+ post_data={"namespace": to_namespace},
+ **kwargs)
+
class ProjectManager(CRUDMixin, RESTManager):
_path = '/projects'