diff options
| author | Gavin Mak <gavinmak@google.com> | 2025-06-13 17:53:38 -0700 |
|---|---|---|
| committer | LUCI <gerrit-scoped@luci-project-accounts.iam.gserviceaccount.com> | 2025-06-18 10:26:27 -0700 |
| commit | 7b6ffed4ae3102b7c90592eeff8e28855cc25c11 (patch) | |
| tree | 13be6b1470be5f3a2fad04797813936c034bb024 /progress.py | |
| parent | b4b323a8bd02d52d060f7f6fa15ba045df5af5b2 (diff) | |
| download | git-repo-7b6ffed4ae3102b7c90592eeff8e28855cc25c11.tar.gz | |
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 <gavinmak@google.com>
Reviewed-by: Scott Lee <ddoman@google.com>
Tested-by: Gavin Mak <gavinmak@google.com>
Diffstat (limited to 'progress.py')
| -rw-r--r-- | progress.py | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/progress.py b/progress.py index fe246c74..a386f426 100644 --- a/progress.py +++ b/progress.py | |||
| @@ -195,6 +195,21 @@ class Progress: | |||
| 195 | ) | 195 | ) |
| 196 | ) | 196 | ) |
| 197 | 197 | ||
| 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 | |||
| 198 | def end(self): | 213 | def end(self): |
| 199 | self._update_event.set() | 214 | self._update_event.set() |
| 200 | if not _TTY or IsTraceToStderr() or self._quiet: | 215 | if not _TTY or IsTraceToStderr() or self._quiet: |
