From 7b6ffed4ae3102b7c90592eeff8e28855cc25c11 Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Fri, 13 Jun 2025 17:53:38 -0700 Subject: sync: Implement --interleaved sync worker For each assigned project, the worker sequentially calls Sync_NetworkHalf and Sync_LocalHalf, respecting --local-only and --network-only flags. To prevent scrambled progress bars, all stderr output from the checkout phase is captured (shown with --verbose). Result objects now carry status and timing information from the worker for state updates. Bug: 421935613 Change-Id: I398602e08a375e974a8914e5fa48ffae673dda9b Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/483301 Commit-Queue: Gavin Mak Reviewed-by: Scott Lee Tested-by: Gavin Mak --- progress.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'progress.py') diff --git a/progress.py b/progress.py index fe246c74..a386f426 100644 --- a/progress.py +++ b/progress.py @@ -195,6 +195,21 @@ class Progress: ) ) + def display_message(self, msg): + """Clears the current progress line and prints a message above it. + + The progress bar is then redrawn on the next line. + """ + if not _TTY or IsTraceToStderr() or self._quiet: + return + + # Erase the current line, print the message with a newline, + # and then immediately redraw the progress bar on the new line. + sys.stderr.write("\r" + CSI_ERASE_LINE) + sys.stderr.write(msg + "\n") + sys.stderr.flush() + self.update(inc=0) + def end(self): self._update_event.set() if not _TTY or IsTraceToStderr() or self._quiet: -- cgit v1.2.3-54-g00ecf