a *Na! @sddlmZddlmZddlmZmZmZddlm Z m Z gdZ Gddde eZ Gdd d e eZ Gd d d e eZGd d d e eZdS))cli) exceptions)RequiredOptional RESTManager RESTObject) NoUpdateMixinObjectDeleteMixin) ProjectBranchProjectBranchManagerProjectProtectedBranchProjectProtectedBranchManagerc@sTeZdZdZededeej d ddZ edeej ddZ dS) r namedevelopers_can_pushdevelopers_can_mergeFcKsR|dd}d|jj|f}||d}|jjj|fd|i|d|jd<dS) a*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 /%2Fz %s/%s/protectr post_dataT protectedNZget_idreplacemanagerpathgitlabZhttp_put_attrs)selfrrkwargsidrrru/private/var/folders/js/6pj4vh5d4zd0k6bxv74qrbhr0000gr/T/pip-target-22xwyzbs/lib/python/gitlab/v4/objects/branches.pyprotectszProjectBranch.protectcKsD|dd}d|jj|f}|jjj|fi|d|jd<dS)aUnprotect 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 rrz%s/%s/unprotectFrNr)rrrrrrr unprotect,s zProjectBranch.unprotectN)FF) __name__ __module__ __qualname___id_attrrZregister_custom_actiontupleexcZ on_http_errorZGitlabProtectErrorr r!rrrrr s  r c@s&eZdZdZeZddiZeddZdS)r z,/projects/%(project_id)s/repository/branches project_idr)branchref)requiredN) r"r#r$_pathr _obj_cls_from_parent_attrsr _create_attrsrrrrr >sr c@seZdZdZdS)r r N)r"r#r$r%rrrrr Esr c@s(eZdZdZeZddiZedddZdS)r z+/projects/%(project_id)s/protected_branchesr(r)r )Zpush_access_levelZmerge_access_levelZunprotect_access_levelZallowed_to_pushZallowed_to_mergeZallowed_to_unprotectZcode_owner_approval_required)r+optionalN) r"r#r$r,r r-r.rr/rrrrr Isr N)rrrr'Z gitlab.baserrrZ gitlab.mixinsrr__all__r r r r rrrrs  0