chore: rename `master` branch to `main` · python-gitlab/python-gitlab@545f8ed · GitHub
Skip to content

Commit 545f8ed

Browse files
committed
chore: rename master branch to main
BREAKING CHANGE: As of python-gitlab 3.0.0, the default branch for development has changed from `master` to `main`.
1 parent 5a1678f commit 545f8ed

30 files changed

Lines changed: 81 additions & 77 deletions

.github/workflows/docs.yml

Lines changed: 2 additions & 1 deletion

.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

0 commit comments

Comments
 (0)