From 6e86d1f503d8b017bd6679a4db70fef532595f65 Mon Sep 17 00:00:00 2001 From: Jordan Justen Date: Mon, 26 Apr 2021 12:29:30 -0700 Subject: [PATCH] bin/pick: Rename master branch to main Signed-off-by: Jordan Justen Reviewed-by: Dylan Baker Reviewed-by: Eric Engestrom --- bin/pick/core.py | 10 +++++----- bin/pick/core_test.py | 6 +++--- bin/pick/ui.py | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/bin/pick/core.py b/bin/pick/core.py index 9b8926224b809..de5d0715cee5c 100644 --- a/bin/pick/core.py +++ b/bin/pick/core.py @@ -42,7 +42,7 @@ if typing.TYPE_CHECKING: nominated: bool nomination_type: typing.Optional[int] resolution: typing.Optional[int] - master_sha: typing.Optional[str] + main_sha: typing.Optional[str] because_sha: typing.Optional[str] IS_FIX = re.compile(r'^\s*fixes:\s*([a-f0-9]{6,40})', flags=re.MULTILINE | re.IGNORECASE) @@ -118,7 +118,7 @@ class Commit: nominated: bool = attr.ib(False) nomination_type: typing.Optional[NominationType] = attr.ib(None) resolution: Resolution = attr.ib(Resolution.UNRESOLVED) - master_sha: typing.Optional[str] = attr.ib(None) + main_sha: typing.Optional[str] = attr.ib(None) because_sha: typing.Optional[str] = attr.ib(None) def to_json(self) -> 'CommitDict': @@ -131,7 +131,7 @@ class Commit: @classmethod def from_json(cls, data: 'CommitDict') -> 'Commit': - c = cls(data['sha'], data['description'], data['nominated'], master_sha=data['master_sha'], because_sha=data['because_sha']) + c = cls(data['sha'], data['description'], data['nominated'], main_sha=data['main_sha'], because_sha=data['because_sha']) if data['nomination_type'] is not None: c.nomination_type = NominationType(data['nomination_type']) if data['resolution'] is not None: @@ -196,9 +196,9 @@ class Commit: async def get_new_commits(sha: str) -> typing.List[typing.Tuple[str, str]]: - # Try to get the authoritative upstream master + # Try to get the authoritative upstream main p = await asyncio.create_subprocess_exec( - 'git', 'for-each-ref', '--format=%(upstream)', 'refs/heads/master', + 'git', 'for-each-ref', '--format=%(upstream)', 'refs/heads/main', stdout=asyncio.subprocess.PIPE, stderr=asyncio.subprocess.DEVNULL) out, _ = await p.communicate() diff --git a/bin/pick/core_test.py b/bin/pick/core_test.py index 6ac186801ab51..a7d14d04d24e5 100644 --- a/bin/pick/core_test.py +++ b/bin/pick/core_test.py @@ -34,7 +34,7 @@ class TestCommit: @pytest.fixture def unnominated_commit(self) -> 'core.Commit': - return core.Commit('abc123', 'sub: A commit', master_sha='45678') + return core.Commit('abc123', 'sub: A commit', main_sha='45678') @pytest.fixture def nominated_commit(self) -> 'core.Commit': @@ -48,7 +48,7 @@ class TestCommit: v = c.to_json() assert v == {'sha': 'abc123', 'description': 'sub: A commit', 'nominated': False, 'nomination_type': None, 'resolution': core.Resolution.UNRESOLVED.value, - 'master_sha': '45678', 'because_sha': None} + 'main_sha': '45678', 'because_sha': None} def test_nominated(self, nominated_commit: 'core.Commit'): c = nominated_commit @@ -58,7 +58,7 @@ class TestCommit: 'nominated': True, 'nomination_type': core.NominationType.CC.value, 'resolution': core.Resolution.UNRESOLVED.value, - 'master_sha': None, + 'main_sha': None, 'because_sha': None} class TestFromJson: diff --git a/bin/pick/ui.py b/bin/pick/ui.py index 3afd05e0ca28e..de9fafd824962 100644 --- a/bin/pick/ui.py +++ b/bin/pick/ui.py @@ -106,8 +106,8 @@ class UI: """Main management object. - :previous_commits: A list of commits to master since this branch was created - :new_commits: Commits added to master since the last time this script was run + :previous_commits: A list of commits to main since this branch was created + :new_commits: Commits added to main since the last time this script was run """ commit_list: typing.List['urwid.Button'] = attr.ib(factory=lambda: urwid.SimpleFocusListWalker([]), init=False)