summaryrefslogtreecommitdiff
path: root/gitlab/v4/objects/branches.py
diff options
context:
space:
mode:
authorNejc Habjan <hab.nejc@gmail.com>2021-09-11 15:46:02 +0200
committerNejc Habjan <hab.nejc@gmail.com>2021-09-11 15:46:02 +0200
commit23434a3f94030f874131c8eb40d474c050ccbc91 (patch)
tree3cf8ab89e6c02b4fd85262cfe37cdc779ef06248 /gitlab/v4/objects/branches.py
parent2b8a94a77ba903ae97228e7ffa3cc2bf6ceb19ba (diff)
downloadgitlab-refactor/remove-deprecated-branch-protect.tar.gz
refactor(objects): remove deprecated branch protect methodsrefactor/remove-deprecated-branch-protect
BREAKING CHANGE: remove deprecated branch protect methods in favor of the more complete protected branches API.
Diffstat (limited to 'gitlab/v4/objects/branches.py')
-rw-r--r--gitlab/v4/objects/branches.py46
1 files changed, 0 insertions, 46 deletions
diff --git a/gitlab/v4/objects/branches.py b/gitlab/v4/objects/branches.py
index 3738657..5bd8442 100644
--- a/gitlab/v4/objects/branches.py
+++ b/gitlab/v4/objects/branches.py
@@ -1,5 +1,3 @@
-from gitlab import cli
-from gitlab import exceptions as exc
from gitlab.base import RequiredOptional, RESTManager, RESTObject
from gitlab.mixins import NoUpdateMixin, ObjectDeleteMixin
@@ -14,50 +12,6 @@ __all__ = [
class ProjectBranch(ObjectDeleteMixin, RESTObject):
_id_attr = "name"
- @cli.register_custom_action(
- "ProjectBranch", tuple(), ("developers_can_push", "developers_can_merge")
- )
- @exc.on_http_error(exc.GitlabProtectError)
- def protect(self, developers_can_push=False, developers_can_merge=False, **kwargs):
- """Protect the branch.
-
- Args:
- developers_can_push (bool): Set to True if developers are allowed
- to push to the branch
- developers_can_merge (bool): Set to True if developers are allowed
- to merge to the branch
- **kwargs: Extra options to send to the server (e.g. sudo)
-
- Raises:
- GitlabAuthenticationError: If authentication is not correct
- GitlabProtectError: If the branch could not be protected
- """
- id = self.get_id().replace("/", "%2F")
- path = "%s/%s/protect" % (self.manager.path, id)
- post_data = {
- "developers_can_push": developers_can_push,
- "developers_can_merge": developers_can_merge,
- }
- self.manager.gitlab.http_put(path, post_data=post_data, **kwargs)
- self._attrs["protected"] = True
-
- @cli.register_custom_action("ProjectBranch")
- @exc.on_http_error(exc.GitlabProtectError)
- def unprotect(self, **kwargs):
- """Unprotect the branch.
-
- Args:
- **kwargs: Extra options to send to the server (e.g. sudo)
-
- Raises:
- GitlabAuthenticationError: If authentication is not correct
- GitlabProtectError: If the branch could not be unprotected
- """
- id = self.get_id().replace("/", "%2F")
- path = "%s/%s/unprotect" % (self.manager.path, id)
- self.manager.gitlab.http_put(path, **kwargs)
- self._attrs["protected"] = False
-
class ProjectBranchManager(NoUpdateMixin, RESTManager):
_path = "/projects/%(project_id)s/repository/branches"