8000 [docs] improve the labels usage documentation · python-gitlab/python-gitlab@5945537 · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit 5945537

Browse files
author
Gauvain Pocentek
committed
[docs] improve the labels usage documentation
Closes #329
1 parent 316754d commit 5945537

File tree

4 files changed

+20
-3
lines changed

4 files changed

+20
-3
lines changed

docs/gl_objects/labels.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,13 @@
2424
# or
2525
label.delete()
2626
# end delete
27+
28+
# use
29+
# Labels are defined as lists in issues and merge requests. The labels must
30+
# exist.
31+
issue = p.issues.create({'title': 'issue title',
32+
'description': 'issue description',
33+
'labels': ['foo']})
34+
issue.labels.append('bar')
35+
issue.save()
36+
# end use

docs/gl_objects/labels.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,9 @@ Delete a label for a project:
5252
.. literalinclude:: labels.py
5353
:start-after: # delete
5454
:end-before: # end delete
55+
56+
Managing labels in issues and merge requests:
57+
58+
.. literalinclude:: labels.py
59+
:start-after: # use
60+
:end-before: # end use

docs/gl_objects/mrs.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
# create
1414
mr = project.mergerequests.create({'source_branch': 'cool_feature',
1515
'target_branch': 'maste 8000 r',
16-
'title': 'merge cool feature'})
16+
'title': 'merge cool feature',
17+
'labels': ['label1', 'label2']})
1718
# end create
1819

1920
# update

docs/gl_objects/projects.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -384,12 +384,12 @@
384384
issue.notes.create({
385385
"body": "See the attached file: {}".format(uploaded_file["markdown"])
386386
})
387-
# project file upload markdown
387+
# end project file upload markdown
388388

389389
# project file upload markdown custom
390390
uploaded_file = project.upload("filename.txt", filedata="data")
391391
issue = project.issues.get(issue_id)
392392
issue.notes.create({
393393
"body": "See the [attached file]({})".format(uploaded_file["url"])
394394
})
395-
# project file upload markdown
395+
# end project file upload markdown custom

0 commit comments

Comments
 (0)
0