File tree 4 files changed +82
-0
lines changed
4 files changed +82
-0
lines changed Original file line number Diff line number Diff line change
1
+ ########################
2
+ API objects manipulation
3
+ ########################
4
+
5
+ .. toctree ::
6
+
7
+ gl_objects/branches
Original file line number Diff line number Diff line change
1
+ # list
2
+ branches = gl .project_branches .list (project_id = 1 )
3
+ # or
4
+ branches = project .branches .list ()
5
+ # end list
6
+
7
+ # get
8
+ branch = gl .project_branches .get (project_id = 1 , id = 'master' )
9
+ # or
10
+ branch = project .branches .get ('master' )
11
+ # end get
12
+
13
+ # create
14
+ branch = gl .project_branches .create ({'branch_name' : 'feature1' ,
15
+ 'ref' : 'master' },
16
+ project_id = 1 )
17
+ # or
18
+ branch = project .branches .create ({'branch_name' : 'feature1' ,
19
+ 'ref' : 'master' })
20
+ # end create
21
+
22
+ # delete
23
+ gl .project_branches .delete (project_id = 1 , id = 'feature1' )
24
+ # or
25
+ project .branches .delete ('feature1' )
26
+ # or
27
+ branch .delete ()
28
+ # end delete
29
+
30
+ # protect
31
+ branch .protect ()
32
+ branch .unprotect ()
33
+ # end protect
Original file line number Diff line number Diff line change
1
+ ########
2
+ Branches
3
+ ########
4
+
5
+ Use :class: `ProjectBranch ` objects to manipulate repository branches.
6
+
7
+ To create :class: `ProjectBranch ` objects use the
8
+ :class: `Gitlab.project_branches ` or :class: `Project.branches ` managers.
9
+
10
+ Examples
11
+ ========
12
+
13
+ Get the list of branches for a repository:
14
+
15
+ .. literalinclude :: branches.py
16
+ :start-after: # list
17
+ :end-before: # end list
18
+
19
+ Get a single repository branch:
20
+
21
+ .. literalinclude :: branches.py
22
+ :start-after: # get
23
+ :end-before: # end get
24
+
25
+ Create a repository branch:
26
+
27
+ .. literalinclude :: branches.py
28
+ :start-after: # create
29
+ :end-before: # end create
30
+
31
+ Delete a repository branch:
32
+
33
+ .. literalinclude :: branches.py
34
+ :start-after: # delete
35
+ :end-before: # end delete
36
+
37
+ Protect/unprotect a repository branch:
38
+
39
+ .. literalinclude :: branches.py
40
+ :start-after: # protect
41
+ :end-before: # end protect
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ Contents:
14
14
install
15
15
cli
16
16
api-usage
17
+ api-objects
17
18
faq
18
19
upgrade-from-0.10
19
20
api/modules
You can’t perform that action at this time.
0 commit comments