Skip to content

Commit a6e1a59

Browse files
committed
sync: Avoid duplicate projects in error text
Keep track of finished projects, not just successful ones, when deciding which projects still need to be synced. Also project errors are already reported by sync workers so stall detection doesn't need to add failed projects to the error list. Bug: 438178765 Change-Id: Ibf15aad009ba7295e70c8df2ff158215085e9732 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/498062 Reviewed-by: Scott Lee <[email protected]> Tested-by: Gavin Mak <[email protected]>
1 parent 380bf95 commit a6e1a59

File tree

1 file changed

+7
-13
lines changed

1 file changed

+7
-13
lines changed

subcmds/sync.py

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2382,7 +2382,7 @@ def _SyncProjectList(cls, opt, project_indices) -> _InterleavedSyncResult:
23822382

23832383
def _ProcessSyncInterleavedResults(
23842384
self,
2385-
synced_relpaths: Set[str],
2385+
finished_relpaths: Set[str],
23862386
err_event: _threading.Event,
23872387
errors: List[Exception],
23882388
opt: optparse.Values,
@@ -2426,9 +2426,9 @@ def _ProcessSyncInterleavedResults(
24262426
result.checkout_success,
24272427
)
24282428

2429-
if result.fetch_success and result.checkout_success:
2430-
synced_relpaths.add(result.relpath)
2431-
else:
2429+
finished_relpaths.add(result.relpath)
2430+
2431+
if not success:
24322432
ret = False
24332433
err_event.set()
24342434
if result.fetch_error:
@@ -2480,7 +2480,7 @@ def _SyncInterleaved(
24802480
self._interleaved_err_checkout_results = []
24812481

24822482
err_event = multiprocessing.Event()
2483-
synced_relpaths = set()
2483+
finished_relpaths = set()
24842484
project_list = list(all_projects)
24852485
pm = Progress(
24862486
"Syncing",
@@ -2514,7 +2514,7 @@ def _SyncInterleaved(
25142514
projects_to_sync = [
25152515
p
25162516
for p in project_list
2517-
if p.relpath not in synced_relpaths
2517+
if p.relpath not in finished_relpaths
25182518
]
25192519
if not projects_to_sync:
25202520
break
@@ -2531,12 +2531,6 @@ def _SyncInterleaved(
25312531
stalled_projects_str,
25322532
)
25332533
err_event.set()
2534-
2535-
# Include these in the final error report.
2536-
self._interleaved_err_checkout = True
2537-
self._interleaved_err_checkout_results.extend(
2538-
list(pending_relpaths)
2539-
)
25402534
break
25412535
previously_pending_relpaths = pending_relpaths
25422536

@@ -2571,7 +2565,7 @@ def _SyncInterleaved(
25712565
jobs = max(1, min(opt.jobs, len(work_items)))
25722566
callback = functools.partial(
25732567
self._ProcessSyncInterleavedResults,
2574-
synced_relpaths,
2568+
finished_relpaths,
25752569
err_event,
25762570
errors,
25772571
opt,

0 commit comments

Comments
 (0)