Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit63b2070

Browse files
authored
Merge pull request#1629 from python-gitlab/chore/master-to-main
chore: rename `master` branch to `main`
2 parents5a1678f +545f8ed commit63b2070

30 files changed

+81
-77
lines changed

‎.github/workflows/docs.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ name: Docs
33
on:
44
push:
55
branches:
6-
-master
6+
-main
77
pull_request:
88
branches:
9+
-main
910
-master
1011

1112
env:

‎.github/workflows/lint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ name: Lint
33
on:
44
push:
55
branches:
6-
-master
6+
-main
77
pull_request:
88
branches:
9+
-main
910
-master
1011

1112
env:

‎.github/workflows/test.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ name: Test
33
on:
44
push:
55
branches:
6-
-master
6+
-main
77
pull_request:
88
branches:
9+
-main
910
-master
1011

1112
env:

‎README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
..image::https://readthedocs.org/projects/python-gitlab/badge/?version=latest
88
:target:https://python-gitlab.readthedocs.org/en/latest/?badge=latest
99

10-
..image::https://codecov.io/github/python-gitlab/python-gitlab/coverage.svg?branch=master
11-
:target:https://codecov.io/github/python-gitlab/python-gitlab?branch=master
10+
..image::https://codecov.io/github/python-gitlab/python-gitlab/coverage.svg?branch=main
11+
:target:https://codecov.io/github/python-gitlab/python-gitlab?branch=main
1212

1313
..image::https://img.shields.io/pypi/pyversions/python-gitlab.svg
1414
:target:https://pypi.python.org/pypi/python-gitlab
@@ -96,4 +96,4 @@ You can build the documentation using ``sphinx``::
9696
Contributing
9797
============
9898

99-
For guidelines for contributing to ``python-gitlab``, refer to `CONTRIBUTING.rst<https://github.com/python-gitlab/python-gitlab/blob/master/CONTRIBUTING.rst>`_.
99+
For guidelines for contributing to ``python-gitlab``, refer to `CONTRIBUTING.rst<https://github.com/python-gitlab/python-gitlab/blob/main/CONTRIBUTING.rst>`_.

‎docs/gl_objects/branches.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ Get the list of branches for a repository::
2222

2323
Get a single repository branch::
2424

25-
branch = project.branches.get('master')
25+
branch = project.branches.get('main')
2626

2727
Create a repository branch::
2828

2929
branch = project.branches.create({'branch': 'feature1',
30-
'ref': 'master'})
30+
'ref': 'main'})
3131

3232
Delete a repository branch::
3333

‎docs/gl_objects/commits.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ Create a commit::
4040
# See https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions
4141
# for actions detail
4242
data = {
43-
'branch': 'master',
43+
'branch': 'main',
4444
'commit_message': 'blah blah blah',
4545
'actions': [
4646
{

‎docs/gl_objects/deployments.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Create a new deployment::
2929
deployment = project.deployments.create({
3030
"environment": "Test",
3131
"sha": "1agf4gs",
32-
"ref": "master",
32+
"ref": "main",
3333
"tag": False,
3434
"status": "created",
3535
})

‎docs/gl_objects/mrs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Get a single MR::
9494
Create a MR::
9595

9696
mr = project.mergerequests.create({'source_branch': 'cool_feature',
97-
'target_branch': 'master',
97+
'target_branch': 'main',
9898
'title': 'merge cool feature',
9999
'labels': ['label1', 'label2']})
100100

‎docs/gl_objects/pipelines_and_jobs.rst

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Get variables of a pipeline::
3535

3636
Create a pipeline for a particular reference with custom variables::
3737

38-
pipeline = project.pipelines.create({'ref': 'master', 'variables': [{'key': 'MY_VARIABLE', 'value': 'hello'}]})
38+
pipeline = project.pipelines.create({'ref': 'main', 'variables': [{'key': 'MY_VARIABLE', 'value': 'hello'}]})
3939

4040
Retry the failed builds for a pipeline::
4141

@@ -97,7 +97,7 @@ Full example with wait for finish::
9797
return project.triggers.create({'description': trigger_decription})
9898

9999
trigger = get_or_create_trigger(project)
100-
pipeline = project.trigger_pipeline('master', trigger.token, variables={"DEPLOY_ZONE": "us-west1"})
100+
pipeline = project.trigger_pipeline('main', trigger.token, variables={"DEPLOY_ZONE": "us-west1"})
101101
while pipeline.finished_at is None:
102102
pipeline.refresh()
103103
time.sleep(1)
@@ -108,7 +108,7 @@ objects to get the associated project::
108108

109109
gl = gitlab.Gitlab(URL) # no authentication
110110
project = gl.projects.get(project_id, lazy=True) # no API call
111-
project.trigger_pipeline('master', trigger_token)
111+
project.trigger_pipeline('main', trigger_token)
112112

113113
Reference: https://docs.gitlab.com/ee/ci/triggers/#trigger-token
114114

@@ -146,7 +146,7 @@ Get a single schedule::
146146
Create a new schedule::
147147

148148
sched = project.pipelineschedules.create({
149-
'ref': 'master',
149+
'ref': 'main',
150150
'description': 'Daily test',
151151
'cron': '0 1 * * *'})
152152

@@ -213,7 +213,7 @@ Examples
213213
Jobs are usually automatically triggered, but you can explicitly trigger a new
214214
job::
215215

216-
project.trigger_build('master', trigger_token,
216+
project.trigger_build('main', trigger_token,
217217
{'extra_var1': 'foo', 'extra_var2': 'bar'})
218218

219219
List jobs for the project::
@@ -247,7 +247,7 @@ Get the artifacts of a job::
247247
Get the artifacts of a job by its name from the latest successful pipeline of
248248
a branch or tag:
249249

250-
project.artifacts(ref_name='master', job='build')
250+
project.artifacts(ref_name='main', job='build')
251251

252252
..warning::
253253

‎docs/gl_objects/projects.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ Update a project submodule::
158158

159159
items = project.update_submodule(
160160
submodule="foo/bar",
161-
branch="master",
161+
branch="main",
162162
commit_sha="4c3674f66071e30b3311dac9b9ccc90502a72664",
163163
commit_message="Message", # optional
164164
)
@@ -199,7 +199,7 @@ Get a snapshot of the repository::
199199

200200
Compare two branches, tags or commits::
201201

202-
result = project.repository_compare('master', 'branch1')
202+
result = project.repository_compare('main', 'branch1')
203203

204204
# get the commits
205205
for commit in result['commits']:
@@ -340,7 +340,7 @@ Examples
340340

341341
Get a file::
342342

343-
f = project.files.get(file_path='README.rst', ref='master')
343+
f = project.files.get(file_path='README.rst', ref='main')
344344

345345
# get the base64 encoded content
346346
print(f.content)
@@ -350,15 +350,15 @@ Get a file::
350350
351351
Get a raw file::
352352
353-
raw_content = project.files.raw(file_path='README.rst', ref='master')
353+
raw_content = project.files.raw(file_path='README.rst', ref='main')
354354
print(raw_content)
355355
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)
357357

358358
Create a new file::
359359

360360
f = project.files.create({'file_path': 'testfile.txt',
361-
'branch': 'master',
361+
'branch': 'main',
362362
'content': file_content,
363363
'author_email': 'test@example.com',
364364
'author_name': 'yourname',
@@ -369,23 +369,23 @@ Update a file. The entire content must be uploaded, as plain text or as base64
369369
encoded text::
370370

371371
f.content = 'new content'
372-
f.save(branch='master', commit_message='Update testfile')
372+
f.save(branch='main', commit_message='Update testfile')
373373

374374
# or for binary data
375375
# Note: decode() is required with python 3 for data serialization. You can omit
376376
# it with python 2
377377
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')
379379

380380
Delete a file::
381381

382-
f.delete(commit_message='Delete testfile', branch='master')
382+
f.delete(commit_message='Delete testfile', branch='main')
383383
# 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')
385385

386386
Get file blame::
387387

388-
b = project.files.blame(file_path='README.rst', ref='master')
388+
b = project.files.blame(file_path='README.rst', ref='main')
389389

390390
Project tags
391391
============
@@ -414,7 +414,7 @@ Get a tag::
414414

415415
Create a tag::
416416

417-
tag = project.tags.create({'tag_name': '1.0', 'ref': 'master'})
417+
tag = project.tags.create({'tag_name': '1.0', 'ref': 'main'})
418418

419419
Delete a tag::
420420

@@ -702,7 +702,7 @@ Get project push rules (returns None is there are no push rules)::
702702

703703
Edit project push rules::
704704

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-.+)$'
706706
pr.save()
707707

708708
Delete project push rules::

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp