From 3538dd224d6d48c60b140103f25d94f0e5f76160 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 26 Aug 2019 15:32:06 -0400 Subject: sync: merge project updates with status bar The current sync output displays "Fetching project" and "Checking out project" messages and progress bar updates independently leading to a lot of spam. Lets merge these periodic outputs with the status bar to get a little bit tighter output in the normal case. This doesn't solve all our problems, but gets us closer. Bug: https://crbug.com/gerrit/11293 Change-Id: Icd627830af4dd934a9355b7ace754b56dc96cfef Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/244934 Reviewed-by: David Pursehouse Tested-by: Mike Frysinger --- progress.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'progress.py') diff --git a/progress.py b/progress.py index 1eff04ac..d2ed4bae 100644 --- a/progress.py +++ b/progress.py @@ -39,7 +39,7 @@ class Progress(object): self._print_newline = print_newline self._always_print_percentage = always_print_percentage - def update(self, inc=1): + def update(self, inc=1, msg=''): self._done += inc if _NOT_TTY or IsTrace(): @@ -62,12 +62,13 @@ class Progress(object): if self._lastp != p or self._always_print_percentage: self._lastp = p - sys.stderr.write('%s\r%s: %3d%% (%d%s/%d%s)%s' % ( + sys.stderr.write('%s\r%s: %3d%% (%d%s/%d%s)%s%s%s' % ( CSI_ERASE_LINE, self._title, p, self._done, self._units, self._total, self._units, + ' ' if msg else '', msg, "\n" if self._print_newline else "")) sys.stderr.flush() -- cgit v1.2.3-54-g00ecf