sync: Switch to using self._bloated_projects

Store bloated projects in self._bloated_projects and print warnings at
the end of execution. This sets up for moving the check to workers.

Bug: 498290329
Change-Id: I993f1fd741db2994d480994861588eb18f6c5503
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/574922
Reviewed-by: Becky Siegel <beckysiegel@google.com>
Tested-by: Gavin Mak <gavinmak@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
Gavin Mak
2026-04-20 17:56:56 +00:00
committed by gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com
parent 61bd6b3ccb
commit 7e9079b7cf
2 changed files with 14 additions and 13 deletions
+3 -2
View File
@@ -490,6 +490,7 @@ class CheckForBloatedProjects(unittest.TestCase):
self.project.Exists = True
self.project.worktree = "worktree"
self.cmd.git_event_log = mock.MagicMock()
self.cmd._bloated_projects = []
@mock.patch("subcmds.sync.git_require")
def test_git_version_unsupported(self, mock_git_require):
@@ -509,7 +510,7 @@ class CheckForBloatedProjects(unittest.TestCase):
@mock.patch("subcmds.sync.git_require")
@mock.patch("subcmds.sync.Progress")
def test_bloated_project_found(self, mock_progress, mock_git_require):
"""Test that it logs warning for bloated project."""
"""Test that it adds project to _bloated_projects."""
mock_git_require.return_value = True
self.cmd.get_parallel_context = mock.Mock(
@@ -527,7 +528,7 @@ class CheckForBloatedProjects(unittest.TestCase):
with mock.patch.object(self.cmd, "ParallelContext"):
self.cmd._CheckForBloatedProjects([self.project], self.opt)
self.cmd.git_event_log.ErrorEvent.assert_called_once()
self.assertEqual(self.cmd._bloated_projects, ["project"])
class GCProjectsTest(unittest.TestCase):