summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGavin Mak <gavinmak@google.com>2025-08-13 01:51:59 +0000
committerGavin Mak <gavinmak@google.com>2025-08-13 23:16:55 -0700
commita6e1a59ac16b294962a9d06f9ed67d78cf74ccd5 (patch)
treead12adeaadf88f5e141ce3ff2f9693a3d18f7757
parent380bf9546e3c54d634e5e57ed77aa19746317032 (diff)
downloadgit-repo-a6e1a59ac16b294962a9d06f9ed67d78cf74ccd5.tar.gz
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 <ddoman@google.com> Tested-by: Gavin Mak <gavinmak@google.com>
-rw-r--r--subcmds/sync.py20
1 files changed, 7 insertions, 13 deletions
diff --git a/subcmds/sync.py b/subcmds/sync.py
index c9b1b5c8..82c065e2 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -2382,7 +2382,7 @@ later is required to fix a server side protocol bug.
2382 2382
2383 def _ProcessSyncInterleavedResults( 2383 def _ProcessSyncInterleavedResults(
2384 self, 2384 self,
2385 synced_relpaths: Set[str], 2385 finished_relpaths: Set[str],
2386 err_event: _threading.Event, 2386 err_event: _threading.Event,
2387 errors: List[Exception], 2387 errors: List[Exception],
2388 opt: optparse.Values, 2388 opt: optparse.Values,
@@ -2426,9 +2426,9 @@ later is required to fix a server side protocol bug.
2426 result.checkout_success, 2426 result.checkout_success,
2427 ) 2427 )
2428 2428
2429 if result.fetch_success and result.checkout_success: 2429 finished_relpaths.add(result.relpath)
2430 synced_relpaths.add(result.relpath) 2430
2431 else: 2431 if not success:
2432 ret = False 2432 ret = False
2433 err_event.set() 2433 err_event.set()
2434 if result.fetch_error: 2434 if result.fetch_error:
@@ -2480,7 +2480,7 @@ later is required to fix a server side protocol bug.
2480 self._interleaved_err_checkout_results = [] 2480 self._interleaved_err_checkout_results = []
2481 2481
2482 err_event = multiprocessing.Event() 2482 err_event = multiprocessing.Event()
2483 synced_relpaths = set() 2483 finished_relpaths = set()
2484 project_list = list(all_projects) 2484 project_list = list(all_projects)
2485 pm = Progress( 2485 pm = Progress(
2486 "Syncing", 2486 "Syncing",
@@ -2514,7 +2514,7 @@ later is required to fix a server side protocol bug.
2514 projects_to_sync = [ 2514 projects_to_sync = [
2515 p 2515 p
2516 for p in project_list 2516 for p in project_list
2517 if p.relpath not in synced_relpaths 2517 if p.relpath not in finished_relpaths
2518 ] 2518 ]
2519 if not projects_to_sync: 2519 if not projects_to_sync:
2520 break 2520 break
@@ -2531,12 +2531,6 @@ later is required to fix a server side protocol bug.
2531 stalled_projects_str, 2531 stalled_projects_str,
2532 ) 2532 )
2533 err_event.set() 2533 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 )
2540 break 2534 break
2541 previously_pending_relpaths = pending_relpaths 2535 previously_pending_relpaths = pending_relpaths
2542 2536
@@ -2571,7 +2565,7 @@ later is required to fix a server side protocol bug.
2571 jobs = max(1, min(opt.jobs, len(work_items))) 2565 jobs = max(1, min(opt.jobs, len(work_items)))
2572 callback = functools.partial( 2566 callback = functools.partial(
2573 self._ProcessSyncInterleavedResults, 2567 self._ProcessSyncInterleavedResults,
2574 synced_relpaths, 2568 finished_relpaths,
2575 err_event, 2569 err_event,
2576 errors, 2570 errors,
2577 opt, 2571 opt,