summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGavin Mak <gavinmak@google.com>2025-07-17 13:17:32 -0700
committerLUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com>2025-07-17 17:30:33 -0700
commit2e6d0881d9df9a61ac7dfa533b727ae9e9b4403e (patch)
tree05b1379e2f5195981be20dd94eb9082bc8350d42
parent74edacd8e54a11c9358421894a5fcce04b02c47d (diff)
downloadgit-repo-2e6d0881d9df9a61ac7dfa533b727ae9e9b4403e.tar.gz
sync: Improve UI and error reporting for interleaved mode
This fixes two issues: 1. the progress bar could show a count greater than the total if new projects were discovered mid-sync. Update the progress bar total dynamically 2. Make "Stall detected" error message more actionable Bug: 432206932 Change-Id: Ie2a4ada5b1770cae0302fb06590641c522cbb7e7 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/491941 Tested-by: Gavin Mak <gavinmak@google.com> Reviewed-by: Scott Lee <ddoman@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
-rw-r--r--progress.py5
-rw-r--r--subcmds/sync.py16
2 files changed, 19 insertions, 2 deletions
diff --git a/progress.py b/progress.py
index 31a4890a..30ec8c3b 100644
--- a/progress.py
+++ b/progress.py
@@ -119,6 +119,11 @@ class Progress:
119 if not quiet and show_elapsed: 119 if not quiet and show_elapsed:
120 self._update_thread.start() 120 self._update_thread.start()
121 121
122 def update_total(self, new_total):
123 """Updates the total if the new total is larger."""
124 if new_total > self._total:
125 self._total = new_total
126
122 def _update_loop(self): 127 def _update_loop(self):
123 while True: 128 while True:
124 self.update(inc=0) 129 self.update(inc=0)
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 250925f4..13a322bc 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -2505,11 +2505,22 @@ later is required to fix a server side protocol bug.
2505 2505
2506 pending_relpaths = {p.relpath for p in projects_to_sync} 2506 pending_relpaths = {p.relpath for p in projects_to_sync}
2507 if previously_pending_relpaths == pending_relpaths: 2507 if previously_pending_relpaths == pending_relpaths:
2508 stalled_projects_str = "\n".join(
2509 f" - {path}"
2510 for path in sorted(list(pending_relpaths))
2511 )
2508 logger.error( 2512 logger.error(
2509 "Stall detected in interleaved sync, not all " 2513 "The following projects failed and could not "
2510 "projects could be synced." 2514 "be synced:\n%s",
2515 stalled_projects_str,
2511 ) 2516 )
2512 err_event.set() 2517 err_event.set()
2518
2519 # Include these in the final error report.
2520 self._interleaved_err_checkout = True
2521 self._interleaved_err_checkout_results.extend(
2522 list(pending_relpaths)
2523 )
2513 break 2524 break
2514 previously_pending_relpaths = pending_relpaths 2525 previously_pending_relpaths = pending_relpaths
2515 2526
@@ -2570,6 +2581,7 @@ later is required to fix a server side protocol bug.
2570 manifest=manifest, 2581 manifest=manifest,
2571 all_manifests=not opt.this_manifest_only, 2582 all_manifests=not opt.this_manifest_only,
2572 ) 2583 )
2584 pm.update_total(len(project_list))
2573 finally: 2585 finally:
2574 sync_event.set() 2586 sync_event.set()
2575 sync_progress_thread.join() 2587 sync_progress_thread.join()