summaryrefslogtreecommitdiff
path: root/docs/gl_objects/branches.rst
diff options
context:
space:
mode:
authorGauvain Pocentek <gauvain@pocentek.net>2018-05-20 09:01:05 +0200
committerGauvain Pocentek <gauvain@pocentek.net>2018-05-20 09:01:05 +0200
commit5292ffb366f97e4dc611dfd49a1dca7d1e934f4c (patch)
tree220659b39e0e5384504de3c63bbff003ad50eec2 /docs/gl_objects/branches.rst
parent2c342372814bbac2203d7b4c0f2cd32541bab979 (diff)
downloadgitlab-5292ffb366f97e4dc611dfd49a1dca7d1e934f4c.tar.gz
[docs] Rework the examples pages
* Get rid of the .py files and bring all the python examples in the RST files * Fix a few things
Diffstat (limited to 'docs/gl_objects/branches.rst')
-rw-r--r--docs/gl_objects/branches.rst40
1 files changed, 14 insertions, 26 deletions
diff --git a/docs/gl_objects/branches.rst b/docs/gl_objects/branches.rst
index 279ca0c..15f2b5c 100644
--- a/docs/gl_objects/branches.rst
+++ b/docs/gl_objects/branches.rst
@@ -11,46 +11,34 @@ References
+ :class:`gitlab.v4.objects.ProjectBranchManager`
+ :attr:`gitlab.v4.objects.Project.branches`
-* v3 API:
-
- + :class:`gitlab.v3.objects.ProjectBranch`
- + :class:`gitlab.v3.objects.ProjectBranchManager`
- + :attr:`gitlab.v3.objects.Project.branches`
-
* GitLab API: https://docs.gitlab.com/ce/api/branches.html
Examples
--------
-Get the list of branches for a repository:
+Get the list of branches for a repository::
-.. literalinclude:: branches.py
- :start-after: # list
- :end-before: # end list
+ branches = project.branches.list()
-Get a single repository branch:
+Get a single repository branch::
-.. literalinclude:: branches.py
- :start-after: # get
- :end-before: # end get
+ branch = project.branches.get('master')
-Create a repository branch:
+Create a repository branch::
-.. literalinclude:: branches.py
- :start-after: # create
- :end-before: # end create
+ branch = project.branches.create({'branch': 'feature1',
+ 'ref': 'master'})
-Delete a repository branch:
+Delete a repository branch::
-.. literalinclude:: branches.py
- :start-after: # delete
- :end-before: # end delete
+ project.branches.delete('feature1')
+ # or
+ branch.delete()
-Protect/unprotect a repository branch:
+Protect/unprotect a repository branch::
-.. literalinclude:: branches.py
- :start-after: # protect
- :end-before: # end protect
+ branch.protect()
+ branch.unprotect()
.. note::