diff --git a/.github/workflows/ci-daily.yml b/.github/workflows/ci-daily.yml index d68ccb38471..2342b588f70 100644 --- a/.github/workflows/ci-daily.yml +++ b/.github/workflows/ci-daily.yml @@ -2,7 +2,7 @@ name: Continuous Integration - Daily on: schedule: - # Checks out master by default. + # Checks out main by default. - cron: '0 0 * * *' concurrency: diff --git a/.github/workflows/ci-weekly.yml b/.github/workflows/ci-weekly.yml index 12d251d3eb4..45b764e0c45 100644 --- a/.github/workflows/ci-weekly.yml +++ b/.github/workflows/ci-weekly.yml @@ -2,7 +2,7 @@ name: Continuous Integration - Weekly on: schedule: - # Checks out master by default. + # Checks out main by default. - cron: '0 0 * * 0' concurrency: diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bb3752f9dcd..012b20475d1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,11 +2,11 @@ name: Continuous Integration on: schedule: - # Checks out master by default. + # Checks out main by default. - cron: '0 0 * * *' pull_request: branches: - - master + - main concurrency: group: ${{ github.head_ref || github.run_id }} diff --git a/.github/workflows/release-master.yml b/.github/workflows/release-main.yml similarity index 98% rename from .github/workflows/release-master.yml rename to .github/workflows/release-main.yml index 58f82bab29f..6fe2b6e6a2e 100644 --- a/.github/workflows/release-master.yml +++ b/.github/workflows/release-main.yml @@ -3,7 +3,7 @@ name: Pre-release cirq to PyPi on: push: branches: - - master + - main jobs: push_to_pypi: if: github.repository == 'quantumlib/Cirq' diff --git a/asv.conf.json b/asv.conf.json index 275793d201e..18449918fee 100644 --- a/asv.conf.json +++ b/asv.conf.json @@ -4,7 +4,7 @@ "project_url": "https://quantumai.google/cirq", "repo": ".", "repo_subdir": "cirq-core/", - "branches": ["master"], + "branches": ["main"], "dvcs": "git", "environment_type": "virtualenv", "show_commit_url": "https://github.com/quantumlib/Cirq/commit/", diff --git a/check/build-changed-protos b/check/build-changed-protos index c95bf7af2c4..c4453373285 100755 --- a/check/build-changed-protos +++ b/check/build-changed-protos @@ -11,14 +11,14 @@ # # You can specify a base git revision to compare against (i.e. to use when # determining whether or not a line is considered to have "changed"). For -# example, you can compare against 'origin/master' or 'HEAD~1'. +# example, you can compare against 'origin/main' or 'HEAD~1'. # # If you don't specify a base revision, the following defaults will be tried, in # order, until one exists: # -# 1. upstream/master -# 2. origin/master -# 3. master +# 1. upstream/main +# 2. origin/main +# 3. main # # If none exists, the script fails. # @@ -37,14 +37,14 @@ if [ -n "$1" ] && [[ $1 != -* ]]; then exit 1 fi rev=$1 -elif [ "$(git cat-file -t upstream/master 2> /dev/null)" == "commit" ]; then - rev=upstream/master -elif [ "$(git cat-file -t origin/master 2> /dev/null)" == "commit" ]; then - rev=origin/master -elif [ "$(git cat-file -t master 2> /dev/null)" == "commit" ]; then - rev=master +elif [ "$(git cat-file -t upstream/main 2> /dev/null)" == "commit" ]; then + rev=upstream/main +elif [ "$(git cat-file -t origin/main 2> /dev/null)" == "commit" ]; then + rev=origin/main +elif [ "$(git cat-file -t main 2> /dev/null)" == "commit" ]; then + rev=main else - echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/master' or 'HEAD~1').\033[0m" >&2 + echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/main' or 'HEAD~1').\033[0m" >&2 exit 1 fi base="$(git merge-base "${rev}" HEAD)" diff --git a/check/format-incremental b/check/format-incremental index 4966e875ebc..74a253efeea 100755 --- a/check/format-incremental +++ b/check/format-incremental @@ -18,14 +18,14 @@ # # You can specify a base git revision to compare against (i.e. to use when # determining whether or not a file is considered to have "changed"). For -# example, you can compare against 'origin/master' or 'HEAD~1'. +# example, you can compare against 'origin/main' or 'HEAD~1'. # # If you don't specify a base revision, the following defaults will be tried, in # order, until one exists: # -# 1. upstream/master -# 2. origin/master -# 3. master +# 1. upstream/main +# 2. origin/main +# 3. main # # If none exists, the script fails. ################################################################################ @@ -61,14 +61,14 @@ typeset -a format_files if (( only_changed == 1 )); then # Figure out which branch to compare against. if [ -z "${rev}" ]; then - if [ "$(git cat-file -t upstream/master 2> /dev/null)" == "commit" ]; then - rev=upstream/master - elif [ "$(git cat-file -t origin/master 2> /dev/null)" == "commit" ]; then - rev=origin/master - elif [ "$(git cat-file -t master 2> /dev/null)" == "commit" ]; then - rev=master + if [ "$(git cat-file -t upstream/main 2> /dev/null)" == "commit" ]; then + rev=upstream/main + elif [ "$(git cat-file -t origin/main 2> /dev/null)" == "commit" ]; then + rev=origin/main + elif [ "$(git cat-file -t main 2> /dev/null)" == "commit" ]; then + rev=main else - echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/master' or 'HEAD~1').\033[0m" >&2 + echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/main' or 'HEAD~1').\033[0m" >&2 exit 1 fi fi diff --git a/check/pylint-changed-files b/check/pylint-changed-files index ca89a65e80c..b335e61d1aa 100755 --- a/check/pylint-changed-files +++ b/check/pylint-changed-files @@ -9,15 +9,15 @@ # You can specify a base git revision to compare against (i.e. to use when # determining whether or not a line is considered to have "changed"). To make # the tool more consistent, it actually diffs against the most recent common -# ancestor of the specified id and HEAD. So if you choose 'origin/master' you're -# actually diffing against the output of 'git merge-base origin/master HEAD'. +# ancestor of the specified id and HEAD. So if you choose 'origin/main' you're +# actually diffing against the output of 'git merge-base origin/main HEAD'. # # If you don't specify a base revision, the following defaults will be tried, # in order, until one exists: # -# 1. upstream/master -# 2. origin/master -# 3. master +# 1. upstream/main +# 2. origin/main +# 3. main # # If none exists, the script fails. # @@ -36,14 +36,14 @@ if [ -n "$1" ] && [[ $1 != -* ]]; then exit 1 fi rev=$1 -elif [ "$(git cat-file -t upstream/master 2> /dev/null)" == "commit" ]; then - rev=upstream/master -elif [ "$(git cat-file -t origin/master 2> /dev/null)" == "commit" ]; then - rev=origin/master -elif [ "$(git cat-file -t master 2> /dev/null)" == "commit" ]; then - rev=master +elif [ "$(git cat-file -t upstream/main 2> /dev/null)" == "commit" ]; then + rev=upstream/main +elif [ "$(git cat-file -t origin/main 2> /dev/null)" == "commit" ]; then + rev=origin/main +elif [ "$(git cat-file -t main 2> /dev/null)" == "commit" ]; then + rev=main else - echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/master' or 'HEAD~1').\033[0m" >&2 + echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/main' or 'HEAD~1').\033[0m" >&2 exit 1 fi base="$(git merge-base "${rev}" HEAD)" diff --git a/check/pytest-and-incremental-coverage b/check/pytest-and-incremental-coverage index 05693bb476a..e088f4d3864 100755 --- a/check/pytest-and-incremental-coverage +++ b/check/pytest-and-incremental-coverage @@ -9,15 +9,15 @@ # You can specify a base git revision to compare against (i.e. to use when # determining whether or not a line is considered to have "changed"). To make # the tool more consistent, it actually diffs against the most recent common -# ancestor of the specified id and HEAD. So if you choose 'origin/master' you're -# actually diffing against the output of 'git merge-base origin/master HEAD'. +# ancestor of the specified id and HEAD. So if you choose 'origin/main' you're +# actually diffing against the output of 'git merge-base origin/main HEAD'. # # If you don't specify a base revision, the following defaults will be tried, # in order, until one exists: # -# 1. upstream/master -# 2. origin/master -# 3. master +# 1. upstream/main +# 2. origin/main +# 3. main # # If none exists, the script fails. ################################################################################ @@ -50,14 +50,14 @@ if [ -n "${BASEREV}" ]; then exit 1 fi rev="${BASEREV}" -elif [ "$(git cat-file -t upstream/master 2> /dev/null)" == "commit" ]; then - rev=upstream/master -elif [ "$(git cat-file -t origin/master 2> /dev/null)" == "commit" ]; then - rev=origin/master -elif [ "$(git cat-file -t master 2> /dev/null)" == "commit" ]; then - rev=master +elif [ "$(git cat-file -t upstream/main 2> /dev/null)" == "commit" ]; then + rev=upstream/main +elif [ "$(git cat-file -t origin/main 2> /dev/null)" == "commit" ]; then + rev=origin/main +elif [ "$(git cat-file -t main 2> /dev/null)" == "commit" ]; then + rev=main else - echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/master' or 'HEAD~1').\033[0m" >&2 + echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/main' or 'HEAD~1').\033[0m" >&2 exit 1 fi base="$(git merge-base "${rev}" HEAD)" diff --git a/check/pytest-changed-files b/check/pytest-changed-files index 974b9472347..8de45dc590d 100755 --- a/check/pytest-changed-files +++ b/check/pytest-changed-files @@ -12,14 +12,14 @@ # # You can specify a base git revision to compare against (i.e. to use when # determining whether or not a file is considered to have "changed"). For -# example, you can compare against 'origin/master' or 'HEAD~1'. +# example, you can compare against 'origin/main' or 'HEAD~1'. # # If you don't specify a base revision, the following defaults will be tried, in # order, until one exists: # -# 1. upstream/master -# 2. origin/master -# 3. master +# 1. upstream/main +# 2. origin/main +# 3. main # # If none exists, the script fails. # @@ -41,14 +41,14 @@ if [ -n "$1" ] && [[ $1 != -* ]]; then fi rev=$1 rest=( "${@:2}" ) -elif [ "$(git cat-file -t upstream/master 2> /dev/null)" == "commit" ]; then - rev=upstream/master -elif [ "$(git cat-file -t origin/master 2> /dev/null)" == "commit" ]; then - rev=origin/master -elif [ "$(git cat-file -t master 2> /dev/null)" == "commit" ]; then - rev=master +elif [ "$(git cat-file -t upstream/main 2> /dev/null)" == "commit" ]; then + rev=upstream/main +elif [ "$(git cat-file -t origin/main 2> /dev/null)" == "commit" ]; then + rev=origin/main +elif [ "$(git cat-file -t main 2> /dev/null)" == "commit" ]; then + rev=main else - echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/master' or 'HEAD~1').\033[0m" >&2 + echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/main' or 'HEAD~1').\033[0m" >&2 exit 1 fi echo "Comparing against revision '${rev}'." >&2 diff --git a/check/pytest-changed-files-and-incremental-coverage b/check/pytest-changed-files-and-incremental-coverage index 373e4075e51..d5b4a38cc40 100755 --- a/check/pytest-changed-files-and-incremental-coverage +++ b/check/pytest-changed-files-and-incremental-coverage @@ -15,15 +15,15 @@ # You can specify a base git revision to compare against (i.e. to use when # determining whether or not a line is considered to have "changed"). To make # the tool more consistent, it actually diffs against the most recent common -# ancestor of the specified id and HEAD. So if you choose 'origin/master' you're -# actually diffing against the output of 'git merge-base origin/master HEAD'. +# ancestor of the specified id and HEAD. So if you choose 'origin/main' you're +# actually diffing against the output of 'git merge-base origin/main HEAD'. # # If you don't specify a base revision, the following defaults will be tried, # in order, until one exists: # -# 1. upstream/master -# 2. origin/master -# 3. master +# 1. upstream/main +# 2. origin/main +# 3. main # # If none exists, the script fails. ################################################################################ @@ -39,14 +39,14 @@ if [ -n "$1" ] && [[ $1 != -* ]]; then exit 1 fi rev=$1 -elif [ "$(git cat-file -t upstream/master 2> /dev/null)" == "commit" ]; then - rev=upstream/master -elif [ "$(git cat-file -t origin/master 2> /dev/null)" == "commit" ]; then - rev=origin/master -elif [ "$(git cat-file -t master 2> /dev/null)" == "commit" ]; then - rev=master +elif [ "$(git cat-file -t upstream/main 2> /dev/null)" == "commit" ]; then + rev=upstream/main +elif [ "$(git cat-file -t origin/main 2> /dev/null)" == "commit" ]; then + rev=origin/main +elif [ "$(git cat-file -t main 2> /dev/null)" == "commit" ]; then + rev=main else - echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/master' or 'HEAD~1').\033[0m" >&2 + echo -e "\033[31mNo default revision found to compare against. Argument #1 must be what to diff against (e.g. 'origin/main' or 'HEAD~1').\033[0m" >&2 exit 1 fi base="$(git merge-base "${rev}" HEAD)" diff --git a/codecov.yml b/codecov.yml index 5283cbd5ac1..636e1d6a512 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,3 +1,5 @@ +comment: false + coverage: status: project: diff --git a/dev_tools/bash_scripts_test.py b/dev_tools/bash_scripts_test.py index cc9e2dbb77d..12f6e8bcfa8 100644 --- a/dev_tools/bash_scripts_test.py +++ b/dev_tools/bash_scripts_test.py @@ -61,7 +61,7 @@ def run( export GIT_CONFIG_SYSTEM=/dev/null dir=$(git rev-parse --show-toplevel) cd {dir_path} -git init --quiet --initial-branch master +git init --quiet --initial-branch main git config --local user.name 'Me' git config --local user.email '<>' git commit -m init --allow-empty --quiet --no-gpg-sign @@ -209,21 +209,21 @@ def test_pytest_changed_files_branch_selection(tmpdir_factory): assert ( result.stderr.split() == ( - "Comparing against revision 'master'.\nFound 0 test files associated with changes.\n" + "Comparing against revision 'main'.\nFound 0 test files associated with changes.\n" ).split() ) result = run( script_file='check/pytest-changed-files', tmpdir_factory=tmpdir_factory, - setup='git branch origin/master', + setup='git branch origin/main', ) assert result.returncode == 0 assert result.stdout == '' assert ( result.stderr.split() == ( - "Comparing against revision 'origin/master'.\n" + "Comparing against revision 'origin/main'.\n" "Found 0 test files associated with changes.\n" ).split() ) @@ -231,14 +231,14 @@ def test_pytest_changed_files_branch_selection(tmpdir_factory): result = run( script_file='check/pytest-changed-files', tmpdir_factory=tmpdir_factory, - setup='git branch upstream/master', + setup='git branch upstream/main', ) assert result.returncode == 0 assert result.stdout == '' assert ( result.stderr.split() == ( - "Comparing against revision 'upstream/master'.\n" + "Comparing against revision 'upstream/main'.\n" "Found 0 test files associated with changes.\n" ).split() ) @@ -246,14 +246,14 @@ def test_pytest_changed_files_branch_selection(tmpdir_factory): result = run( script_file='check/pytest-changed-files', tmpdir_factory=tmpdir_factory, - setup='git branch upstream/master; git branch origin/master', + setup='git branch upstream/main; git branch origin/main', ) assert result.returncode == 0 assert result.stdout == '' assert ( result.stderr.split() == ( - "Comparing against revision 'upstream/master'.\n" + "Comparing against revision 'upstream/main'.\n" "Found 0 test files associated with changes.\n" ).split() ) @@ -262,7 +262,7 @@ def test_pytest_changed_files_branch_selection(tmpdir_factory): script_file='check/pytest-changed-files', tmpdir_factory=tmpdir_factory, arg='file', - setup='git checkout -b other --quiet\ngit branch -D master --quiet\n', + setup='git checkout -b other --quiet\ngit branch -D main --quiet\n', ) assert result.returncode == 1 assert result.stdout == '' @@ -298,14 +298,14 @@ def test_pytest_changed_files_branch_selection(tmpdir_factory): result = run( script_file='check/pytest-changed-files', tmpdir_factory=tmpdir_factory, - setup='touch master\ngit add -A\ngit commit -m test --quiet --no-gpg-sign\n', + setup='touch main\ngit add -A\ngit commit -m test --quiet --no-gpg-sign\n', ) assert result.returncode == 0 assert result.stdout == '' assert ( result.stderr.split() == ( - "Comparing against revision 'master'.\nFound 0 test files associated with changes.\n" + "Comparing against revision 'main'.\nFound 0 test files associated with changes.\n" ).split() ) @@ -315,20 +315,20 @@ def test_pytest_changed_files_branch_selection(tmpdir_factory): tmpdir_factory=tmpdir_factory, setup='mkdir alt\n' 'cd alt\n' - 'git init --quiet --initial-branch master\n' + 'git init --quiet --initial-branch main\n' 'git config --local user.name \'Me\'\n' 'git config --local user.email \'<>\'\n' 'git commit -m tes --quiet --allow-empty --no-gpg-sign\n' 'cd ..\n' 'git remote add origin alt\n' - 'git fetch origin master --quiet 2> /dev/null\n', + 'git fetch origin main --quiet 2> /dev/null\n', ) assert result.returncode == 0 assert result.stdout == '' assert ( result.stderr.split() == ( - "Comparing against revision 'origin/master'.\n" + "Comparing against revision 'origin/main'.\n" "Found 0 test files associated with changes.\n" ).split() ) @@ -376,14 +376,14 @@ def test_pytest_and_incremental_coverage_branch_selection(tmpdir_factory): 'Get in touch if you still use it: ned@nedbatchelder.com\n' 'No data to report.\n' 'INTERCEPTED ' - 'python dev_tools/check_incremental_coverage_annotations.py master\n' + 'python dev_tools/check_incremental_coverage_annotations.py main\n' ) - assert result.stderr == "Comparing against revision 'master'.\n" + assert result.stderr == "Comparing against revision 'main'.\n" result = run( script_file='check/pytest-and-incremental-coverage', tmpdir_factory=tmpdir_factory, - setup='git branch origin/master', + setup='git branch origin/main', additional_intercepts=['check/pytest'], ) assert result.returncode == 0 @@ -394,14 +394,14 @@ def test_pytest_and_incremental_coverage_branch_selection(tmpdir_factory): 'Get in touch if you still use it: ned@nedbatchelder.com\n' 'No data to report.\n' 'INTERCEPTED ' - 'python dev_tools/check_incremental_coverage_annotations.py origin/master\n' + 'python dev_tools/check_incremental_coverage_annotations.py origin/main\n' ) - assert result.stderr == "Comparing against revision 'origin/master'.\n" + assert result.stderr == "Comparing against revision 'origin/main'.\n" result = run( script_file='check/pytest-and-incremental-coverage', tmpdir_factory=tmpdir_factory, - setup='git branch upstream/master', + setup='git branch upstream/main', additional_intercepts=['check/pytest'], ) assert result.returncode == 0 @@ -412,14 +412,14 @@ def test_pytest_and_incremental_coverage_branch_selection(tmpdir_factory): 'Get in touch if you still use it: ned@nedbatchelder.com\n' 'No data to report.\n' 'INTERCEPTED ' - 'python dev_tools/check_incremental_coverage_annotations.py upstream/master\n' + 'python dev_tools/check_incremental_coverage_annotations.py upstream/main\n' ) - assert result.stderr == "Comparing against revision 'upstream/master'.\n" + assert result.stderr == "Comparing against revision 'upstream/main'.\n" result = run( script_file='check/pytest-and-incremental-coverage', tmpdir_factory=tmpdir_factory, - setup='git branch upstream/master; git branch origin/master', + setup='git branch upstream/main; git branch origin/main', additional_intercepts=['check/pytest'], ) assert result.returncode == 0 @@ -430,14 +430,14 @@ def test_pytest_and_incremental_coverage_branch_selection(tmpdir_factory): 'Get in touch if you still use it: ned@nedbatchelder.com\n' 'No data to report.\n' 'INTERCEPTED ' - 'python dev_tools/check_incremental_coverage_annotations.py upstream/master\n' + 'python dev_tools/check_incremental_coverage_annotations.py upstream/main\n' ) - assert result.stderr == "Comparing against revision 'upstream/master'.\n" + assert result.stderr == "Comparing against revision 'upstream/main'.\n" result = run( script_file='check/pytest-and-incremental-coverage', tmpdir_factory=tmpdir_factory, - setup='git checkout -b other --quiet\ngit branch -D master --quiet\n', + setup='git checkout -b other --quiet\ngit branch -D main --quiet\n', additional_intercepts=['check/pytest'], ) assert result.returncode == 1 @@ -467,7 +467,7 @@ def test_pytest_and_incremental_coverage_branch_selection(tmpdir_factory): result = run( script_file='check/pytest-and-incremental-coverage', tmpdir_factory=tmpdir_factory, - setup='touch master\ngit add -A\ngit commit -m test --quiet --no-gpg-sign\n', + setup='touch main\ngit add -A\ngit commit -m test --quiet --no-gpg-sign\n', additional_intercepts=['check/pytest'], ) assert result.returncode == 0 @@ -478,18 +478,18 @@ def test_pytest_and_incremental_coverage_branch_selection(tmpdir_factory): 'Get in touch if you still use it: ned@nedbatchelder.com\n' 'No data to report.\n' 'INTERCEPTED ' - 'python dev_tools/check_incremental_coverage_annotations.py master\n' + 'python dev_tools/check_incremental_coverage_annotations.py main\n' ) - assert result.stderr == "Comparing against revision 'master'.\n" + assert result.stderr == "Comparing against revision 'main'.\n" result = run( script_file='check/pytest-and-incremental-coverage', tmpdir_factory=tmpdir_factory, - setup='touch master\n' + setup='touch main\n' 'git add -A\n' 'git commit -q -m test --no-gpg-sign\n' 'git branch alt\n' - 'touch master2\n' + 'touch main2\n' 'git add -A\n' 'git commit -q -m test2 --no-gpg-sign\n' 'git checkout -q alt\n', @@ -505,7 +505,7 @@ def test_pytest_and_incremental_coverage_branch_selection(tmpdir_factory): 'INTERCEPTED ' 'python dev_tools/check_incremental_coverage_annotations.py ' ) - assert result.stderr.startswith("Comparing against revision 'master' (merge base ") + assert result.stderr.startswith("Comparing against revision 'main' (merge base ") @only_on_posix @@ -525,39 +525,39 @@ def test_incremental_format_branch_selection(tmpdir_factory): result = run(script_file='check/format-incremental', tmpdir_factory=tmpdir_factory) assert result.returncode == 0 assert "No files to format" in result.stdout - assert "Comparing against revision 'master'." in result.stderr + assert "Comparing against revision 'main'." in result.stderr result = run( script_file='check/format-incremental', tmpdir_factory=tmpdir_factory, - setup='git branch origin/master', + setup='git branch origin/main', ) assert result.returncode == 0 assert "No files to format" in result.stdout - assert "Comparing against revision 'origin/master'." in result.stderr + assert "Comparing against revision 'origin/main'." in result.stderr result = run( script_file='check/format-incremental', tmpdir_factory=tmpdir_factory, - setup='git branch upstream/master', + setup='git branch upstream/main', ) assert result.returncode == 0 assert "No files to format" in result.stdout - assert "Comparing against revision 'upstream/master'." in result.stderr + assert "Comparing against revision 'upstream/main'." in result.stderr result = run( script_file='check/format-incremental', tmpdir_factory=tmpdir_factory, - setup='git branch upstream/master; git branch origin/master', + setup='git branch upstream/main; git branch origin/main', ) assert result.returncode == 0 assert "No files to format" in result.stdout - assert "Comparing against revision 'upstream/master'." in result.stderr + assert "Comparing against revision 'upstream/main'." in result.stderr result = run( script_file='check/format-incremental', tmpdir_factory=tmpdir_factory, - setup='git checkout -b other --quiet\ngit branch -D master --quiet\n', + setup='git checkout -b other --quiet\ngit branch -D main --quiet\n', ) assert result.returncode == 1 assert result.stdout == '' @@ -578,20 +578,20 @@ def test_incremental_format_branch_selection(tmpdir_factory): result = run( script_file='check/format-incremental', tmpdir_factory=tmpdir_factory, - setup='touch master.py\ngit add -A\ngit commit -m test --quiet --no-gpg-sign\n', + setup='touch main.py\ngit add -A\ngit commit -m test --quiet --no-gpg-sign\n', ) assert result.returncode == 0 assert "No files to format" in result.stdout - assert "Comparing against revision 'master'." in result.stderr + assert "Comparing against revision 'main'." in result.stderr result = run( script_file='check/format-incremental', tmpdir_factory=tmpdir_factory, - setup='touch master.py\n' + setup='touch main.py\n' 'git add -A\n' 'git commit -q -m test --no-gpg-sign\n' 'git branch alt\n' - 'touch master2.py\n' + 'touch main2.py\n' 'git add -A\n' 'git commit -q -m test2 --no-gpg-sign\n' 'git checkout -q alt\n' @@ -601,7 +601,7 @@ def test_incremental_format_branch_selection(tmpdir_factory): ) assert result.returncode == 0 assert 'INTERCEPTED black --color --check --diff alt.py' in result.stdout - assert result.stderr.startswith("Comparing against revision 'master' (merge base ") + assert result.stderr.startswith("Comparing against revision 'main' (merge base ") @only_on_posix diff --git a/dev_tools/check_incremental_coverage_annotations.py b/dev_tools/check_incremental_coverage_annotations.py index 69b01fe043f..5649002a719 100644 --- a/dev_tools/check_incremental_coverage_annotations.py +++ b/dev_tools/check_incremental_coverage_annotations.py @@ -24,7 +24,7 @@ def main(): if len(sys.argv) < 2: print( shell_tools.highlight( - 'Must specify a comparison branch (e.g. "origin/master" or "HEAD~1").', + 'Must specify a comparison branch (e.g. "origin/main" or "HEAD~1").', shell_tools.RED, ) ) diff --git a/dev_tools/conf/pip-install-minimal-for-pytest-changed-files.sh b/dev_tools/conf/pip-install-minimal-for-pytest-changed-files.sh index 741a0ab6e65..72b6e41b642 100755 --- a/dev_tools/conf/pip-install-minimal-for-pytest-changed-files.sh +++ b/dev_tools/conf/pip-install-minimal-for-pytest-changed-files.sh @@ -26,7 +26,7 @@ reqs=( ) # Install contrib requirements only if needed. -changed=$(git diff --name-only origin/master | grep "cirq/contrib" || true) +changed=$(git diff --name-only origin/main | grep "cirq/contrib" || true) [ "${changed}" = "" ] || reqs+=( -r cirq-core/cirq/contrib/requirements.txt ) pip install "${reqs[@]}" diff --git a/dev_tools/docs/build_api_docs.py b/dev_tools/docs/build_api_docs.py index 456ed8c2e03..809c5a33681 100644 --- a/dev_tools/docs/build_api_docs.py +++ b/dev_tools/docs/build_api_docs.py @@ -47,7 +47,7 @@ flags.DEFINE_string( "code_url_prefix", - "https://github.com/quantumlib/Cirq/blob/master", + "https://github.com/quantumlib/Cirq/blob/main", "The url prefix for links to code.", ) diff --git a/dev_tools/git_env_tools.py b/dev_tools/git_env_tools.py index 05c16cc1c15..b11a712f805 100644 --- a/dev_tools/git_env_tools.py +++ b/dev_tools/git_env_tools.py @@ -86,7 +86,7 @@ def fetch_github_pull_request( destination_directory: The location to fetch the contents into. repository: The github repository that the commit lives under. pull_request_number: The id of the pull request to clone. If None, then - the master branch is cloned instead. + the main branch is cloned instead. verbose: When set, more progress output is produced. Returns: @@ -100,10 +100,7 @@ def fetch_github_pull_request( optional_quiet = [] if verbose else ['--quiet'] shell_tools.run(['git', 'init', *optional_quiet], stdout=sys.stderr) result = _git_fetch_for_comparison( - remote=repository.as_remote(), - actual_branch=branch, - compare_branch='master', - verbose=verbose, + remote=repository.as_remote(), actual_branch=branch, compare_branch='main', verbose=verbose ) optional_actual_commit_id = [] if result.actual_commit_id is None else [result.actual_commit_id] shell_tools.run( @@ -165,7 +162,7 @@ def fetch_local_files(destination_directory: str, verbose: bool) -> prepared_env shell_tools.run( ['git', 'init', *optional_quiet], stdout=sys.stderr, log_run_to_stderr=verbose ) - result = _git_fetch_for_comparison(staging_dir, cur_commit, 'master', verbose=verbose) + result = _git_fetch_for_comparison(staging_dir, cur_commit, 'main', verbose=verbose) finally: shutil.rmtree(staging_dir, ignore_errors=True) diff --git a/dev_tools/notebooks/isolated_notebook_test.py b/dev_tools/notebooks/isolated_notebook_test.py index a1f1e7f9912..477d59d9f23 100644 --- a/dev_tools/notebooks/isolated_notebook_test.py +++ b/dev_tools/notebooks/isolated_notebook_test.py @@ -105,7 +105,7 @@ # TODO(3577): extract these out to common utilities when we rewrite bash scripts in python def _find_base_revision(): - for rev in ['upstream/master', 'origin/master', 'master']: + for rev in ['upstream/main', 'origin/main', 'main']: try: result = subprocess.run( f'git cat-file -t {rev}'.split(), stdout=subprocess.PIPE, universal_newlines=True @@ -184,7 +184,7 @@ def _rewrite_and_run_notebook(notebook_path, cloned_env): f"notebook (in Github Actions, you can download it from the workflow artifact" f" 'notebook-outputs'). \n" f"If this is a new failure in this notebook due to a new change, " - f"that is only available in master for now, consider adding `pip install --pre cirq` " + f"that is only available in main for now, consider adding `pip install --pre cirq` " f"instead of `pip install cirq` to this notebook, and exclude it from " f"dev_tools/notebooks/isolated_notebook_test.py." ) diff --git a/dev_tools/pr_monitor.py b/dev_tools/pr_monitor.py index 1ae6c4c23d1..3f041d6a675 100644 --- a/dev_tools/pr_monitor.py +++ b/dev_tools/pr_monitor.py @@ -540,9 +540,9 @@ def wait_for_polling_period(): time.sleep(POLLING_PERIOD.total_seconds()) -def absent_status_checks(pr: PullRequestDetails, master_data: Optional[Any] = None) -> Set[str]: - if pr.base_branch_name == 'master' and master_data is not None: - branch_data = master_data +def absent_status_checks(pr: PullRequestDetails, main_data: Optional[Any] = None) -> Set[str]: + if pr.base_branch_name == 'main' and main_data is not None: + branch_data = main_data else: branch_data = get_branch_details(pr.repo, pr.base_branch_name) status_data = get_pr_statuses(pr) @@ -581,9 +581,9 @@ def get_repo_ref(repo: GithubRepository, ref: str) -> Dict[str, Any]: return payload -def get_master_sha(repo: GithubRepository) -> str: +def get_main_sha(repo: GithubRepository) -> str: """Get the sha hash for the given repo.""" - ref = get_repo_ref(repo, 'heads/master') + ref = get_repo_ref(repo, 'heads/main') return ref['object']['sha'] @@ -644,7 +644,7 @@ def update_branch(pr: PullRequestDetails) -> Union[bool, CannotAutomergeError]: """Equivalent to hitting the 'update branch' button on a PR. As of Feb 2020 this API feature is still in beta. Note that currently, if - you attempt to update branch when already synced to master, a vacuous merge + you attempt to update branch when already synced to main, a vacuous merge commit will be created. References: @@ -681,8 +681,8 @@ def update_branch(pr: PullRequestDetails) -> Union[bool, CannotAutomergeError]: return True -def attempt_sync_with_master(pr: PullRequestDetails) -> Union[bool, CannotAutomergeError]: - """Sync a pull request with the master branch. +def attempt_sync_with_main(pr: PullRequestDetails) -> Union[bool, CannotAutomergeError]: + """Sync a pull request with the main branch. References: https://developer.github.com/v3/repos/merging/#perform-a-merge @@ -696,19 +696,15 @@ def attempt_sync_with_master(pr: PullRequestDetails) -> Union[bool, CannotAutome Raises: RuntimeError: If the merge request returned a failed response. """ - master_sha = get_master_sha(pr.repo) + main_sha = get_main_sha(pr.repo) remote = pr.remote_repo url = f"https://api.github.com/repos/{remote.organization}/{remote.name}/merges" - data = { - 'base': pr.branch_name, - 'head': master_sha, - 'commit_message': 'Update branch (automerge)', - } + data = {'base': pr.branch_name, 'head': main_sha, 'commit_message': 'Update branch (automerge)'} response = pr.remote_repo.post(url, json=data) if response.status_code == 201: # Merge succeeded. - log(f'Synced #{pr.pull_id} ({pr.title!r}) with master.') + log(f'Synced #{pr.pull_id} ({pr.title!r}) with main.') return True if response.status_code == 204: @@ -723,12 +719,12 @@ def attempt_sync_with_master(pr: PullRequestDetails) -> Union[bool, CannotAutome # Permission denied. return CannotAutomergeError( "Spurious failure. Github API requires me to be an admin on the " - "fork repository to merge master into the PR branch. Hit " + "fork repository to merge main into the PR branch. Hit " "'Update Branch' for me before trying again." ) raise RuntimeError( - 'Sync with master failed for unknown reason. ' + 'Sync with main failed for unknown reason. ' f'Code: {response.status_code}. Content: {response.content!r}.' ) @@ -936,13 +932,13 @@ def find_auto_mergeable_prs(repo: GithubRepository) -> List[int]: def find_problem_with_automergeability_of_pr( - pr: PullRequestDetails, master_branch_data: Any + pr: PullRequestDetails, main_branch_data: Any ) -> Optional[CannotAutomergeError]: # Sanity. if pr.payload['state'] != 'open': return CannotAutomergeError('Not an open pull request.') - if pr.base_branch_name != 'master': - return CannotAutomergeError('Can only automerge into master.') + if pr.base_branch_name != 'main': + return CannotAutomergeError('Can only automerge into main.') if pr.payload['mergeable_state'] == 'dirty': return CannotAutomergeError('There are merge conflicts.') @@ -972,7 +968,7 @@ def find_problem_with_automergeability_of_pr( # Some issues can only be detected after waiting a bit. if not pr.modified_recently: # Nothing is setting a required status check. - missing_statuses = absent_status_checks(pr, master_branch_data) + missing_statuses = absent_status_checks(pr, main_branch_data) if missing_statuses: return CannotAutomergeError( 'A required status check is not present.\n\n' @@ -1025,8 +1021,8 @@ def gather_auto_mergeable_prs( ) -> List[PullRequestDetails]: result = [] raw_prs = list_open_pull_requests(repo) - master_branch_data = get_branch_details(repo, 'master') - if branch_data_modified_recently(master_branch_data): + main_branch_data = get_branch_details(repo, 'main') + if branch_data_modified_recently(main_branch_data): return [] prev_seen_times = dict(problem_seen_times) @@ -1037,7 +1033,7 @@ def gather_auto_mergeable_prs( # Looking up a single PR gives more data, e.g. the 'mergeable' entry. pr = PullRequestDetails.from_github(repo, raw_pr.pull_id) - problem = find_problem_with_automergeability_of_pr(pr, master_branch_data) + problem = find_problem_with_automergeability_of_pr(pr, main_branch_data) if problem is None: result.append(pr) diff --git a/dev_tools/pr_monitor.sh b/dev_tools/pr_monitor.sh index b8a8414e61e..cd262f8029a 100755 --- a/dev_tools/pr_monitor.sh +++ b/dev_tools/pr_monitor.sh @@ -21,7 +21,7 @@ # labelled PR, the script will not label any other PRs with 'front_of_queue_automerge'. # # While there is a 'front_of_queue_automerge' labelled PR, the script will sync that PR -# with master, wait for status checks to succeed, and attempt to merge it into master. +# with main, wait for status checks to succeed, and attempt to merge it into main. # If the PR goes out of date due to an intervening merge, the process will start over. # This will continue until either the PR is merged or there is a problem that must be # addressed by a human. After merging, the PR will be deleted unless it belongs to a diff --git a/dev_tools/pr_monitor/README.md b/dev_tools/pr_monitor/README.md index accbfb28cc6..ca1914732e3 100644 --- a/dev_tools/pr_monitor/README.md +++ b/dev_tools/pr_monitor/README.md @@ -9,9 +9,9 @@ If there are multiple 'automerge' PRs, the bot prefers PRs that require less wor While there is a 'front_of_queue_automerge' labelled PR, depending on the state of the PR, the script might do all of the following: - * sync that PR with master + * sync that PR with main * wait for status checks to succeed - * attempt to merge it into master. + * attempt to merge it into main. If the PR goes out of date due to an intervening merge, the process will start over. This will continue until either the PR is merged or there is a problem that must be addressed by a human. After merging, the PR will be deleted unless it belongs to a @@ -35,7 +35,7 @@ Extra Large (XL): >= 1000 total changes. The bot lives in the cirq-infra project and is deployed as a GKE Deployment \ (see [Cirq infra](../cirq-infra/README.md) for more details on our GCP setup). -On every push to master, Cloud Build triggers the execution of cloudbuild-deploy.yaml. +On every push to main, Cloud Build triggers the execution of cloudbuild-deploy.yaml. ## Configuration files @@ -64,7 +64,7 @@ gcloud container clusters get-credentials cirq-infra --zone us-central1-a ### Cloud Build file The [cloudbuild-deploy.yaml](cloudbuild-deploy.yaml) describes the workflow that is executed \ -when we push something to master. It is responsible for building the docker image and deploying \ +when we push something to main. It is responsible for building the docker image and deploying \ the new version of the pr monitor script to GKE. @@ -102,4 +102,4 @@ If you want to iterate faster, you can also try using skaffold itself in dev mod skaffold dev -f dev_tools/pr_monitor/skaffold.yaml ``` - \ No newline at end of file + diff --git a/dev_tools/triage-party/README.md b/dev_tools/triage-party/README.md index 5eef66ce446..5957ba94abf 100644 --- a/dev_tools/triage-party/README.md +++ b/dev_tools/triage-party/README.md @@ -19,7 +19,7 @@ Where `$HOME/.github-token` is a file containing the token. # Cloud Build based deployment -On every push to master Triage Party is redeployed as defined by [cloudbuild-deploy.yaml](cloudbuild-deploy.yaml). +On every push to main Triage Party is redeployed as defined by [cloudbuild-deploy.yaml](cloudbuild-deploy.yaml). # Deploying Triage Party manually diff --git a/rtd_docs/conf.py b/rtd_docs/conf.py index 8bf090ad79e..d2a1f071694 100644 --- a/rtd_docs/conf.py +++ b/rtd_docs/conf.py @@ -44,13 +44,13 @@ templates_path = ['_templates'] # Allow markdown includes. -# http://www.sphinx-doc.org/en/master/markdown.html +# http://www.sphinx-doc.org/en/main/markdown.html # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # source_suffix = {'.rst': 'restructuredtext', '.md': 'markdown'} -# The master toctree document. +# The main toctree document. master_doc = 'index' # The language for content autogenerated by Sphinx. Refer to documentation