| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,9 +3,10 @@ name: Docs | |||
| 3 | 3 | on: | |
| 4 | 4 | push: | |
| 5 | 5 | branches: | |
| 6 | - - master | ||
| 6 | + - main | ||
| 7 | 7 | pull_request: | |
| 8 | 8 | branches: | |
| 9 | + - main | ||
| 9 | 10 | - master | |
| 10 | 11 | ||
| 11 | 12 | env: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,9 +3,10 @@ name: Lint | |||
| 3 | 3 | on: | |
| 4 | 4 | push: | |
| 5 | 5 | branches: | |
| 6 | - - master | ||
| 6 | + - main | ||
| 7 | 7 | pull_request: | |
| 8 | 8 | branches: | |
| 9 | + - main | ||
| 9 | 10 | - master | |
| 10 | 11 | ||
| 11 | 12 | env: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,9 +3,10 @@ name: Test | |||
| 3 | 3 | on: | |
| 4 | 4 | push: | |
| 5 | 5 | branches: | |
| 6 | - - master | ||
| 6 | + - main | ||
| 7 | 7 | pull_request: | |
| 8 | 8 | branches: | |
| 9 | + - main | ||
| 9 | 10 | - master | |
| 10 | 11 | ||
| 11 | 12 | env: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -7,8 +7,8 @@ | |||
| 7 | 7 | .. image:: https://readthedocs.org/projects/python-gitlab/badge/?version=latest | |
| 8 | 8 | :target: https://python-gitlab.readthedocs.org/en/latest/?badge=latest | |
| 9 | 9 | ||
| 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 | ||
| 12 | 12 | ||
| 13 | 13 | .. image:: https://img.shields.io/pypi/pyversions/python-gitlab.svg | |
| 14 | 14 | :target: https://pypi.python.org/pypi/python-gitlab | |
@@ -96,4 +96,4 @@ You can build the documentation using ``sphinx``:: | |||
| 96 | 96 | Contributing | |
| 97 | 97 | ============ | |
| 98 | 98 | ||
| 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>`_. | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -22,12 +22,12 @@ Get the list of branches for a repository:: | |||
| 22 | 22 | ||
| 23 | 23 | Get a single repository branch:: | |
| 24 | 24 | ||
| 25 | - branch = project.branches.get('master') | ||
| 25 | + branch = project.branches.get('main') | ||
| 26 | 26 | ||
| 27 | 27 | Create a repository branch:: | |
| 28 | 28 | ||
| 29 | 29 | branch = project.branches.create({'branch': 'feature1', | |
| 30 | - 'ref': 'master'}) | ||
| 30 | + 'ref': 'main'}) | ||
| 31 | 31 | ||
| 32 | 32 | Delete a repository branch:: | |
| 33 | 33 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -40,7 +40,7 @@ Create a commit:: | |||
| 40 | 40 | # See https://docs.gitlab.com/ce/api/commits.html#create-a-commit-with-multiple-files-and-actions | |
| 41 | 41 | # for actions detail | |
| 42 | 42 | data = { | |
| 43 | - 'branch': 'master', | ||
| 43 | + 'branch': 'main', | ||
| 44 | 44 | 'commit_message': 'blah blah blah', | |
| 45 | 45 | 'actions': [ | |
| 46 | 46 | { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -29,7 +29,7 @@ Create a new deployment:: | |||
| 29 | 29 | deployment = project.deployments.create({ | |
| 30 | 30 | "environment": "Test", | |
| 31 | 31 | "sha": "1agf4gs", | |
| 32 | - "ref": "master", | ||
| 32 | + "ref": "main", | ||
| 33 | 33 | "tag": False, | |
| 34 | 34 | "status": "created", | |
| 35 | 35 | }) | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -94,7 +94,7 @@ Get a single MR:: | |||
| 94 | 94 | Create a MR:: | |
| 95 | 95 | ||
| 96 | 96 | mr = project.mergerequests.create({'source_branch': 'cool_feature', | |
| 97 | - 'target_branch': 'master', | ||
| 97 | + 'target_branch': 'main', | ||
| 98 | 98 | 'title': 'merge cool feature', | |
| 99 | 99 | 'labels': ['label1', 'label2']}) | |
| 100 | 100 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -35,7 +35,7 @@ Get variables of a pipeline:: | |||
| 35 | 35 | ||
| 36 | 36 | Create a pipeline for a particular reference with custom variables:: | |
| 37 | 37 | ||
| 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'}]}) | ||
| 39 | 39 | ||
| 40 | 40 | Retry the failed builds for a pipeline:: | |
| 41 | 41 | ||
@@ -97,7 +97,7 @@ Full example with wait for finish:: | |||
| 97 | 97 | return project.triggers.create({'description': trigger_decription}) | |
| 98 | 98 | ||
| 99 | 99 | 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"}) | ||
| 101 | 101 | while pipeline.finished_at is None: | |
| 102 | 102 | pipeline.refresh() | |
| 103 | 103 | time.sleep(1) | |
@@ -108,7 +108,7 @@ objects to get the associated project:: | |||
| 108 | 108 | ||
| 109 | 109 | gl = gitlab.Gitlab(URL) # no authentication | |
| 110 | 110 | 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) | ||
| 112 | 112 | ||
| 113 | 113 | Reference: https://docs.gitlab.com/ee/ci/triggers/#trigger-token | |
| 114 | 114 | ||
@@ -146,7 +146,7 @@ Get a single schedule:: | |||
| 146 | 146 | Create a new schedule:: | |
| 147 | 147 | ||
| 148 | 148 | sched = project.pipelineschedules.create({ | |
| 149 | - 'ref': 'master', | ||
| 149 | + 'ref': 'main', | ||
| 150 | 150 | 'description': 'Daily test', | |
| 151 | 151 | 'cron': '0 1 * * *'}) | |
| 152 | 152 | ||
@@ -213,7 +213,7 @@ Examples | |||
| 213 | 213 | Jobs are usually automatically triggered, but you can explicitly trigger a new | |
| 214 | 214 | job:: | |
| 215 | 215 | ||
| 216 | - project.trigger_build('master', trigger_token, | ||
| 216 | + project.trigger_build('main', trigger_token, | ||
| 217 | 217 | {'extra_var1': 'foo', 'extra_var2': 'bar'}) | |
| 218 | 218 | ||
| 219 | 219 | List jobs for the project:: | |
@@ -247,7 +247,7 @@ Get the artifacts of a job:: | |||
| 247 | 247 | Get the artifacts of a job by its name from the latest successful pipeline of | |
| 248 | 248 | a branch or tag: | |
| 249 | 249 | ||
| 250 | - project.artifacts(ref_name='master', job='build') | ||
| 250 | + project.artifacts(ref_name='main', job='build') | ||
| 251 | 251 | ||
| 252 | 252 | .. warning:: | |
| 253 | 253 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -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:: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments