Skip to content

Commit d828900

Browse files
committed
Remove unused get_branch_status and get_branch_status_short
The only usage for them was in the tests atm and doesn't count.
1 parent d93173b commit d828900

File tree

2 files changed

+9
-27
lines changed

2 files changed

+9
-27
lines changed

core/git_mixins/status.py

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -147,31 +147,6 @@ def _group_status_entries(self, file_status_list):
147147
merge_conflicts=conflicts,
148148
)
149149

150-
def get_branch_status(self, *, delim="\n "):
151-
# type: (str) -> str
152-
"""
153-
Return a tuple of:
154-
155-
1) the name of the active branch
156-
2) the status of the active local branch
157-
compared to its remote counterpart.
158-
159-
If no remote or tracking branch is defined, do not include remote-data.
160-
If HEAD is detached, provide that status instead.
161-
162-
If a delimiter is provided, join tuple components with it, and return
163-
that value.
164-
"""
165-
lines = self._get_status()
166-
branch_status = self._get_branch_status_components(lines)
167-
return self._format_branch_status(branch_status, delim)
168-
169-
def get_branch_status_short(self):
170-
# type: () -> str
171-
lines = self._get_status()
172-
branch_status = self._get_branch_status_components(lines)
173-
return self._format_branch_status_short(branch_status)
174-
175150
def _get_branch_status_components(self, lines):
176151
# type: (List[str]) -> HeadState
177152
"""

tests/test_repo_status.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,16 @@ def tearDown(self):
9797
@p.expand(TestShortBranchStatusTestcases)
9898
def test_format_branch_status_for_statusbar(self, status_lines, expected):
9999
git = GitCommand()
100+
when(git).get_repo_path().thenReturn("somewhere")
100101
when(git).in_rebase().thenReturn(False)
101102
when(git).in_merge().thenReturn(False)
102103
when(git).in_cherry_pick().thenReturn(False)
103104
when(git).in_revert().thenReturn(False)
104105

105106
when(git).git("status", ...).thenReturn(status_lines)
106107

107-
actual = git.get_branch_status_short()
108+
git.get_working_dir_status()
109+
actual = git.current_state().get("short_status")
108110
self.assertEqual(actual, expected)
109111

110112
# TODO: Add tests for `in_rebase` True
@@ -234,14 +236,19 @@ def tearDown(self):
234236
@p.expand(TestLongBranchStatusTestcases)
235237
def test_format_branch_status_for_status_dashboard(self, status_lines, expected):
236238
git = GitCommand()
239+
when(git).get_repo_path().thenReturn("somewhere")
237240
when(git).in_rebase().thenReturn(False)
238241
when(git).in_merge().thenReturn(False)
239242
when(git).in_cherry_pick().thenReturn(False)
240243
when(git).in_revert().thenReturn(False)
241244

242245
when(git).git("status", ...).thenReturn(status_lines)
243246

244-
actual = git.get_branch_status(delim="\n")
247+
git.get_working_dir_status()
248+
actual = "\n".join(
249+
line.lstrip()
250+
for line in git.current_state().get("long_status").splitlines()
251+
)
245252
self.assertEqual(actual, expected)
246253

247254
# TODO: Add tests for `in_rebase` True

0 commit comments

Comments
 (0)