diff options
author | Jeroen Schutrup <jschutrup@bol.com> | 2019-07-11 16:25:21 +0200 |
---|---|---|
committer | Jeroen Schutrup <jeroenschutrup@hotmail.nl> | 2019-07-11 22:56:27 +0200 |
commit | bc4280c2fbff115bd5e29a6f5012ae518610f626 (patch) | |
tree | 365647f969b08edb8b40d9ff937c175933017a15 /gitlab | |
parent | ad1c0dda37f573673beaf9f25187f51751a5a484 (diff) | |
download | gitlab-bc4280c2fbff115bd5e29a6f5012ae518610f626.tar.gz |
feat: add mr rebase method
Diffstat (limited to 'gitlab')
-rw-r--r-- | gitlab/exceptions.py | 4 | ||||
-rw-r--r-- | gitlab/v4/objects.py | 16 |
2 files changed, 20 insertions, 0 deletions
diff --git a/gitlab/exceptions.py b/gitlab/exceptions.py index 449b6f0..d644e0f 100644 --- a/gitlab/exceptions.py +++ b/gitlab/exceptions.py @@ -173,6 +173,10 @@ class GitlabMRApprovalError(GitlabOperationError): pass +class GitlabMRRebaseError(GitlabOperationError): + pass + + class GitlabMRClosedError(GitlabOperationError): pass diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index f452aa7..770b3e0 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -2712,6 +2712,22 @@ class ProjectMergeRequest( server_data = self.manager.gitlab.http_post(path, post_data=data, **kwargs) self._update_attrs(server_data) + @cli.register_custom_action("ProjectMergeRequest") + @exc.on_http_error(exc.GitlabMRRebaseError) + def rebase(self, **kwargs): + """Attempt to rebase the source branch onto the target branch + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabMRRebaseError: If rebasing failed + """ + path = "%s/%s/rebase" % (self.manager.path, self.get_id()) + data = {} + return self.manager.gitlab.http_put(path, post_data=data, **kwargs) + @cli.register_custom_action( "ProjectMergeRequest", tuple(), |