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
+11 -11
View File
@@ -1448,7 +1448,6 @@ later is required to fix a server side protocol bug.
if not projects:
return
bloated_projects = []
pm = Progress(
"Checking for bloat", len(projects), delay=False, quiet=opt.quiet
)
@@ -1456,7 +1455,7 @@ later is required to fix a server side protocol bug.
def _ProcessResults(pool, pm, results):
for result in results:
if result:
bloated_projects.append(result)
self._bloated_projects.append(result)
pm.update(msg="")
with self.ParallelContext():
@@ -1471,15 +1470,6 @@ later is required to fix a server side protocol bug.
)
pm.end()
for project_name in bloated_projects:
warn_msg = (
f'warning: Project "{project_name}" is accumulating '
'unoptimized data. Please run "repo sync --auto-gc" or '
'"repo gc --repack" to clean up.'
)
self.git_event_log.ErrorEvent(warn_msg)
logger.warning(warn_msg)
def _UpdateRepoProject(self, opt, manifest, errors):
"""Fetch the repo project and check for updates."""
if opt.local_only:
@@ -2097,6 +2087,7 @@ later is required to fix a server side protocol bug.
self._fetch_times = _FetchTimes(manifest)
self._local_sync_state = LocalSyncState(manifest)
self._bloated_projects = []
if opt.interleaved:
sync_method = self._SyncInterleaved
@@ -2137,6 +2128,15 @@ later is required to fix a server side protocol bug.
if existing:
self._CheckForBloatedProjects(all_projects, opt)
for project_name in sorted(self._bloated_projects):
warn_msg = (
f'warning: Project "{project_name}" is accumulating '
'unoptimized data. Please run "repo sync --auto-gc" or '
'"repo gc --repack" to clean up.'
)
self.git_event_log.ErrorEvent(warn_msg)
logger.warning(warn_msg)
if not opt.quiet:
print("repo sync has finished successfully.")