diff options
author | Sebastian Kratzert <sebastian.kratzert@iav.de> | 2019-09-04 13:07:35 +0200 |
---|---|---|
committer | Max Wittig <max.wittig@siemens.com> | 2019-10-06 18:10:40 +0200 |
commit | 4d1e3774706f336e87ebe70e1b373ddb37f34b45 (patch) | |
tree | dae80ead71c38f5316dd4864c69f94a68770c81d /gitlab/v4/objects.py | |
parent | fcea41c61f7776cf57ed5001facbc1e77d2834c4 (diff) | |
download | gitlab-4d1e3774706f336e87ebe70e1b373ddb37f34b45.tar.gz |
feat(project): implement update_submodule
Diffstat (limited to 'gitlab/v4/objects.py')
-rw-r--r-- | gitlab/v4/objects.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 15aecf5..cdd847f 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -3885,6 +3885,29 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject): ("wikis", "ProjectWikiManager"), ) + @cli.register_custom_action("Project", ("submodule", "branch", "commit_sha")) + @exc.on_http_error(exc.GitlabUpdateError) + def update_submodule(self, submodule, branch, commit_sha, **kwargs): + """Transfer a project to the given namespace ID + + Args: + submodule (str): Full path to the submodule + branch (str): Name of the branch to commit into + commit_sha (str): Full commit SHA to update the submodule to + commit_message (str): Commit message. If no message is provided, a default one will be set (optional) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabPutError: If the submodule could not be updated + """ + + submodule = submodule.replace("/", "%2F") # .replace('.', '%2E') + path = "/projects/%s/repository/submodules/%s" % (self.get_id(), submodule) + data = {"branch": branch, "commit_sha": commit_sha} + if "commit_message" in kwargs: + data["commit_message"] = kwargs["commit_message"] + return self.manager.gitlab.http_put(path, post_data=data) + @cli.register_custom_action("Project", tuple(), ("path", "ref", "recursive")) @exc.on_http_error(exc.GitlabGetError) def repository_tree(self, path="", ref="", recursive=False, **kwargs): |