@@ -158,7 +158,7 @@ Update a project submodule::
158
158
159
159
items = project.update_submodule(
160
160
submodule="foo/bar",
161
- branch="master ",
161
+ branch="main ",
162
162
commit_sha="4c3674f66071e30b3311dac9b9ccc90502a72664",
163
163
commit_message="Message", # optional
164
164
)
@@ -199,7 +199,7 @@ Get a snapshot of the repository::
199
199
200
200
Compare two branches, tags or commits::
201
201
202
- result = project.repository_compare('master ', 'branch1')
202
+ result = project.repository_compare('main ', 'branch1')
203
203
204
204
# get the commits
205
205
for commit in result['commits']:
@@ -340,7 +340,7 @@ Examples
340
340
341
341
Get a file::
342
342
343
- f = project.files.get(file_path='README.rst', ref='master ')
343
+ f = project.files.get(file_path='README.rst', ref='main ')
344
344
345
345
# get the base64 encoded content
346
346
print(f.content)
@@ -350,15 +350,15 @@ Get a file::
350
350
351
351
Get a raw file::
352
352
353
- raw_content = project.files.raw(file_path='README.rst', ref='master ')
353
+ raw_content = project.files.raw(file_path='README.rst', ref='main ')
354
354
print(raw_content)
355
355
with open('/tmp/raw-download.txt', 'wb') as f:
356
- project.files.raw(file_path='README.rst', ref='master ', streamed=True, action=f.write)
356
+ project.files.raw(file_path='README.rst', ref='main ', streamed=True, action=f.write)
357
357
358
358
Create a new file::
359
359
360
360
f = project.files.create({'file_path': 'testfile.txt',
361
- 'branch': 'master ',
361
+ 'branch': 'main ',
362
362
'content': file_content,
363
363
'author_email': 'test@example.com',
364
364
'author_name': 'yourname',
@@ -369,23 +369,23 @@ Update a file. The entire content must be uploaded, as plain text or as base64
369
369
encoded text::
370
370
371
371
f.content = 'new content'
372
- f.save(branch='master ', commit_message='Update testfile')
372
+ f.save(branch='main ', commit_message='Update testfile')
373
373
374
374
# or for binary data
375
375
# Note: decode() is required with python 3 for data serialization. You can omit
376
376
# it with python 2
377
377
f.content = base64.b64encode(open('image.png').read()).decode()
378
- f.save(branch='master ', commit_message='Update testfile', encoding='base64')
378
+ f.save(branch='main ', commit_message='Update testfile', encoding='base64')
379
379
380
380
Delete a file::
381
381
382
- f.delete(commit_message='Delete testfile', branch='master ')
382
+ f.delete(commit_message='Delete testfile', branch='main ')
383
383
# or
384
- project.files.delete(file_path='testfile.txt', commit_message='Delete testfile', branch='master ')
384
+ project.files.delete(file_path='testfile.txt', commit_message='Delete testfile', branch='main ')
385
385
386
386
Get file blame::
387
387
388
- b = project.files.blame(file_path='README.rst', ref='master ')
388
+ b = project.files.blame(file_path='README.rst', ref='main ')
389
389
390
390
Project tags
391
391
============
@@ -414,7 +414,7 @@ Get a tag::
414
414
415
415
Create a tag::
416
416
417
- tag = project.tags.create({'tag_name': '1.0', 'ref': 'master '})
417
+ tag = project.tags.create({'tag_name': '1.0', 'ref': 'main '})
418
418
419
419
Delete a tag::
420
420
@@ -702,7 +702,7 @@ Get project push rules (returns None is there are no push rules)::
702
702
703
703
Edit project push rules::
704
704
705
- pr.branch_name_regex = '^(master |develop|support-\d+|release-\d+\..+|hotfix-.+|feature-.+)$'
705
+ pr.branch_name_regex = '^(main |develop|support-\d+|release-\d+\..+|hotfix-.+|feature-.+)$'
706
706
pr.save()
707
707
708
708
Delete project push rules::
0 commit comments