From 590ea0da7e5617c42e705c62370d6e94ff46ea74 Mon Sep 17 00:00:00 2001 From: Gauvain Pocentek Date: Sun, 27 May 2018 18:58:47 +0200 Subject: Add support for merged branches deletion --- gitlab/v4/objects.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'gitlab/v4/objects.py') diff --git a/gitlab/v4/objects.py b/gitlab/v4/objects.py index 3372d47..2c96e74 100644 --- a/gitlab/v4/objects.py +++ b/gitlab/v4/objects.py @@ -2811,6 +2811,21 @@ class Project(SaveMixin, ObjectDeleteMixin, RESTObject): path = '/projects/%s/fork' % self.get_id() self.manager.gitlab.http_delete(path, **kwargs) + @cli.register_custom_action('Project') + @exc.on_http_error(exc.GitlabDeleteError) + def delete_merged_branches(self, **kwargs): + """Delete merged branches. + + Args: + **kwargs: Extra options to send to the server (e.g. sudo) + + Raises: + GitlabAuthenticationError: If authentication is not correct + GitlabDeleteError: If the server failed to perform the request + """ + path = '/projects/%s/repository/merged_branches' % self.get_id() + self.manager.gitlab.http_delete(path, **kwargs) + @cli.register_custom_action('Project') @exc.on_http_error(exc.GitlabCreateError) def star(self, **kwargs): -- cgit v1.2.1