Skip to content

Commit 4e0ec18

Browse files
authored
Change references to "master" to be to "main" (#1151)
This resolves #1138.
1 parent 9a508c0 commit 4e0ec18

24 files changed

+188
-187
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ on:
2929
pull_request:
3030
types: [opened, synchronize]
3131
branches:
32-
- master
32+
- main
3333

3434
merge_group:
3535
types:

.github/workflows/osv-scanner.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,6 @@ on:
3838
types: [opened, synchronize]
3939
branches:
4040
- main
41-
- master
4241

4342
# Support merge queues.
4443
merge_group:

.github/workflows/scorecard-scanner.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ on:
2929
types: [opened, synchronize]
3030
branches:
3131
- main
32-
- master
3332

3433
# Support merge queues.
3534
merge_group:

README.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.. image:: https://raw.githubusercontent.com/quantumlib/OpenFermion/refs/heads/master/docs/images/logo_horizontal.svg
1+
.. image:: https://raw.githubusercontent.com/quantumlib/OpenFermion/refs/heads/main/docs/images/logo_horizontal.svg
22
:alt: OpenFermion logo
33
:width: 75%
44
:align: center
@@ -42,7 +42,7 @@ You can run the interactive Jupyter Notebooks in |Colab|_ or |MyBinder|_.
4242
.. _Colab: https://colab.research.google.com/github/quantumlib/OpenFermion
4343

4444
.. |MyBinder| replace:: MyBinder
45-
.. _MyBinder: https://mybinder.org/v2/gh/quantumlib/OpenFermion/master?filepath=examples
45+
.. _MyBinder: https://mybinder.org/v2/gh/quantumlib/OpenFermion/main?filepath=examples
4646

4747
Installation and Documentation
4848
==============================
@@ -64,7 +64,7 @@ the electronic structure plugins are only compatible on these platforms. However
6464
for those who would like to use Windows, or for anyone having other difficulties
6565
with installing OpenFermion or its plugins, we provide a Docker image
6666
and usage instructions in the
67-
`docker folder <https://github.com/quantumlib/OpenFermion/tree/master/docker>`__.
67+
`docker folder <https://github.com/quantumlib/OpenFermion/tree/main/docker>`__.
6868
The Docker image provides a virtual environment with OpenFermion and select plugins pre-installed.
6969
The Docker installation should run on any operating system where Docker can be used.
7070

check/format-incremental

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@
3131
#
3232
# You can specify a base git revision to compare against (i.e. to use when
3333
# determining whether or not a file is considered to have "changed"). For
34-
# example, you can compare against 'origin/master' or 'HEAD~1'.
34+
# example, you can compare against 'origin/main' or 'HEAD~1'.
3535
#
3636
# If you don't specify a base revision, the following defaults will be tried, in
3737
# order, until one exists:
3838
#
39-
# 1. upstream/master
40-
# 2. origin/master
41-
# 3. master
39+
# 1. upstream/main
40+
# 2. origin/main
41+
# 3. main
4242
#
4343
# If none exists, the script fails.
4444
################################################################################
@@ -48,7 +48,6 @@ thisdir="$(dirname "${BASH_SOURCE[0]}")" || exit $?
4848
topdir="$(git -C "${thisdir}" rev-parse --show-toplevel)" || exit $?
4949
cd "${topdir}" || exit $?
5050

51-
5251
# Parse arguments.
5352
only_print=1
5453
only_changed=1
@@ -74,14 +73,14 @@ typeset -a format_files
7473
if (( only_changed == 1 )); then
7574
# Figure out which branch to compare against.
7675
if [ -z "${rev}" ]; then
77-
if [ "$(git cat-file -t upstream/master 2> /dev/null)" == "commit" ]; then
78-
rev=upstream/master
79-
elif [ "$(git cat-file -t origin/master 2> /dev/null)" == "commit" ]; then
80-
rev=origin/master
81-
elif [ "$(git cat-file -t master 2> /dev/null)" == "commit" ]; then
82-
rev=master
76+
if [ "$(git cat-file -t upstream/main 2> /dev/null)" == "commit" ]; then
77+
rev=upstream/main
78+
elif [ "$(git cat-file -t origin/main 2> /dev/null)" == "commit" ]; then
79+
rev=origin/main
80+
elif [ "$(git cat-file -t main 2> /dev/null)" == "commit" ]; then
81+
rev=main
8382
else
84-
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
83+
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
8584
exit 1
8685
fi
8786
fi

check/pylint-changed-files

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
# If you don't specify a base revision, the following defaults will be tried,
2929
# in order, until one exists:
3030
#
31-
# 1. upstream/main or upstream/master
32-
# 2. origin/main or origin/master
33-
# 3. main or master
31+
# 1. upstream/main
32+
# 2. origin/main
33+
# 3. main
3434
#
3535
# If none exists, the script will exit with an error.
3636
#
@@ -43,22 +43,19 @@ thisdir=$(dirname "${BASH_SOURCE[0]:?}") || exit $?
4343
repo_dir=$(git -C "${thisdir}" rev-parse --show-toplevel) || exit $?
4444
cd "${repo_dir}" || exit $?
4545

46-
# Some old repos used "master" instead of main. Find out which one we have here.
47-
default=$(git branch --format '%(refname:short)' --list master main)
48-
4946
# Figure out which revision to compare against.
5047
if [ -n "$1" ] && [[ $1 != -* ]]; then
5148
if ! git rev-parse --verify --quiet --no-revs "$1^{commit}"; then
5249
echo -e "\033[31mNo revision '$1'.\033[0m" >&2
5350
exit 1
5451
fi
5552
rev=$1
56-
elif [ "$(git cat-file -t "upstream/${default}" 2> /dev/null)" == "commit" ]; then
57-
rev=upstream/${default}
58-
elif [ "$(git cat-file -t "origin/${default}" 2> /dev/null)" == "commit" ]; then
59-
rev=origin/${default}
60-
elif [ "$(git cat-file -t "${default}" 2> /dev/null)" == "commit" ]; then
61-
rev=${default}
53+
elif [ "$(git cat-file -t "upstream/main" 2> /dev/null)" == "commit" ]; then
54+
rev=upstream/main
55+
elif [ "$(git cat-file -t "origin/main" 2> /dev/null)" == "commit" ]; then
56+
rev=origin/main
57+
elif [ "$(git cat-file -t "main" 2> /dev/null)" == "commit" ]; then
58+
rev=main
6259
else
6360
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
6461
exit 1

check/pytest-and-incremental-coverage

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@
2222
# You can specify a base git revision to compare against (i.e. to use when
2323
# determining whether or not a line is considered to have "changed"). To make
2424
# the tool more consistent, it actually diffs against the most recent common
25-
# ancestor of the specified id and HEAD. So if you choose 'origin/master' you're
26-
# actually diffing against the output of 'git merge-base origin/master HEAD'.
25+
# ancestor of the specified id and HEAD. So if you choose 'origin/main' you're
26+
# actually diffing against the output of 'git merge-base origin/main HEAD'.
2727
#
2828
# If you don't specify a base revision, the following defaults will be tried,
2929
# in order, until one exists:
3030
#
31-
# 1. upstream/master
32-
# 2. origin/master
33-
# 3. master
31+
# 1. upstream/main
32+
# 2. origin/main
33+
# 3. main
3434
#
3535
# If none exists, the script fails.
3636
################################################################################
@@ -46,14 +46,14 @@ if [[ -n "$1" && $1 != -* ]]; then
4646
exit 1
4747
fi
4848
rev=$1
49-
elif [ "$(git cat-file -t upstream/master 2> /dev/null)" == "commit" ]; then
50-
rev=upstream/master
51-
elif [ "$(git cat-file -t origin/master 2> /dev/null)" == "commit" ]; then
52-
rev=origin/master
53-
elif [ "$(git cat-file -t master 2> /dev/null)" == "commit" ]; then
54-
rev=master
49+
elif [ "$(git cat-file -t upstream/main 2> /dev/null)" == "commit" ]; then
50+
rev=upstream/main
51+
elif [ "$(git cat-file -t origin/main 2> /dev/null)" == "commit" ]; then
52+
rev=origin/main
53+
elif [ "$(git cat-file -t main 2> /dev/null)" == "commit" ]; then
54+
rev=main
5555
else
56-
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
56+
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
5757
exit 1
5858
fi
5959
# shellcheck disable=SC2086

dev_tools/check_incremental_coverage_annotations.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def main():
2626
if len(sys.argv) < 2:
2727
print(
2828
shell_tools.highlight(
29-
'Must specify a comparison branch (e.g. "origin/master" or "HEAD~1").',
29+
'Must specify a comparison branch (e.g. "origin/main" or "HEAD~1").',
3030
shell_tools.RED,
3131
)
3232
)

dev_tools/docs/build_api_docs.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,18 +24,19 @@
2424

2525
import openfermion
2626

27-
flags.DEFINE_string("output_dir", "/tmp/openfermion_api",
28-
"Where to output the docs")
27+
flags.DEFINE_string("output_dir", "/tmp/openfermion_api", "Where to output the docs")
2928

30-
flags.DEFINE_string("code_url_prefix",
31-
("https://github.com/quantumlib/OpenFermion/tree/master/src"
32-
"openfermion"), "The url prefix for links to code.")
29+
flags.DEFINE_string(
30+
"code_url_prefix",
31+
("https://github.com/quantumlib/OpenFermion/tree/main/src" "openfermion"),
32+
"The url prefix for links to code.",
33+
)
3334

34-
flags.DEFINE_bool("search_hints", True,
35-
"Include metadata search hints in the generated files")
35+
flags.DEFINE_bool("search_hints", True, "Include metadata search hints in the generated files")
3636

37-
flags.DEFINE_string("site_path", "quark/openfermion/api_docs/python",
38-
"Path prefix in the _toc.yaml")
37+
flags.DEFINE_string(
38+
"site_path", "quark/openfermion/api_docs/python", "Path prefix in the _toc.yaml"
39+
)
3940

4041
FLAGS = flags.FLAGS
4142

@@ -55,7 +56,8 @@ def main(unused_argv):
5556
# Example:
5657
# "cirq.google.engine.client.quantum.QuantumEngineServiceClient":
5758
# ["enums"]
58-
})
59+
},
60+
)
5961

6062
doc_generator.build(output_dir=FLAGS.output_dir)
6163

0 commit comments

Comments
 (0)