|
| 1 | +################## |
| 2 | +Protected branches |
| 3 | +################## |
| 4 | + |
| 5 | +You can define a list of protected branch names on a repository. Names can use |
| 6 | +wildcards (``*``). |
| 7 | + |
| 8 | +References |
| 9 | +---------- |
| 10 | + |
| 11 | +* v4 API: |
| 12 | + |
| 13 | + +:class:`gitlab.v4.objects.ProjectProtectedBranch` |
| 14 | + +:class:`gitlab.v4.objects.ProjectProtectedBranchManager` |
| 15 | + +:attr:`gitlab.v4.objects.Project.protectedbranches` |
| 16 | + |
| 17 | +* GitLab API: https://docs.gitlab.com/ce/api/protected_branches.html#protected-branches-api |
| 18 | + |
| 19 | +Examples |
| 20 | +-------- |
| 21 | + |
| 22 | +Get the list of protected branches for a project: |
| 23 | + |
| 24 | +..literalinclude::branches.py |
| 25 | +:start-after: # p_branch list |
| 26 | +:end-before: # end p_branch list |
| 27 | + |
| 28 | +Get a single protected branch: |
| 29 | + |
| 30 | +..literalinclude::branches.py |
| 31 | +:start-after: # p_branch get |
| 32 | +:end-before: # end p_branch get |
| 33 | + |
| 34 | +Create a protected branch: |
| 35 | + |
| 36 | +..literalinclude::branches.py |
| 37 | +:start-after: # p_branch create |
| 38 | +:end-before: # end p_branch create |
| 39 | + |
| 40 | +Delete a protected branch: |
| 41 | + |
| 42 | +..literalinclude::branches.py |
| 43 | +:start-after: # p_branch delete |
| 44 | +:end-before: # end p_branch delete |