Skip to content

Commit 7b6ffed

Browse files
gavinmakLUCI
authored andcommitted
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 <[email protected]> Reviewed-by: Scott Lee <[email protected]> Tested-by: Gavin Mak <[email protected]>
1 parent b4b323a commit 7b6ffed

File tree

3 files changed

+483
-114
lines changed

3 files changed

+483
-114
lines changed

progress.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,21 @@ def update(self, inc=1, msg=None):
195195
)
196196
)
197197

198+
def display_message(self, msg):
199+
"""Clears the current progress line and prints a message above it.
200+
201+
The progress bar is then redrawn on the next line.
202+
"""
203+
if not _TTY or IsTraceToStderr() or self._quiet:
204+
return
205+
206+
# Erase the current line, print the message with a newline,
207+
# and then immediately redraw the progress bar on the new line.
208+
sys.stderr.write("\r" + CSI_ERASE_LINE)
209+
sys.stderr.write(msg + "\n")
210+
sys.stderr.flush()
211+
self.update(inc=0)
212+
198213
def end(self):
199214
self._update_event.set()
200215
if not _TTY or IsTraceToStderr() or self._quiet:

0 commit comments

Comments
 (0)