mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
Display the name of the repository that is being updated.
Patch contributed by Anton Staaf. BUG=None TEST=run "gclient config ...; gclient sync chromium" Review URL: http://codereview.chromium.org/3497013 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@61733 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
@@ -663,7 +663,7 @@ class ExecutionQueue(object):
|
||||
t.join()
|
||||
sys.stdout.full_flush()
|
||||
if self.progress:
|
||||
self.progress.update(1)
|
||||
self.progress.update(1, t.item.name)
|
||||
assert not t.item.name in self.ran
|
||||
if not t.item.name in self.ran:
|
||||
self.ran.append(t.item.name)
|
||||
@@ -681,7 +681,7 @@ class ExecutionQueue(object):
|
||||
task_item.run(*args, **kwargs)
|
||||
self.ran.append(task_item.name)
|
||||
if self.progress:
|
||||
self.progress.update(1)
|
||||
self.progress.update(1, ', '.join(t.item.name for t in self.running))
|
||||
|
||||
class _Worker(threading.Thread):
|
||||
"""One thread to execute one WorkItem."""
|
||||
|
||||
29
third_party/repo/progress.py
vendored
29
third_party/repo/progress.py
vendored
@@ -24,8 +24,9 @@ class Progress(object):
|
||||
self._lastp = -1
|
||||
self._start = time()
|
||||
self._show = False
|
||||
self._width = 0
|
||||
|
||||
def update(self, inc=1):
|
||||
def update(self, inc=1, extra=''):
|
||||
self._done += inc
|
||||
|
||||
if not self._show:
|
||||
@@ -34,35 +35,37 @@ class Progress(object):
|
||||
else:
|
||||
return
|
||||
|
||||
text = None
|
||||
|
||||
if self._total <= 0:
|
||||
sys.stdout.write('\r%s: %d, ' % (
|
||||
self._title,
|
||||
self._done))
|
||||
sys.stdout.flush()
|
||||
text = '%s: %3d' % (self._title, self._done)
|
||||
else:
|
||||
p = (100 * self._done) / self._total
|
||||
|
||||
if self._lastp != p:
|
||||
self._lastp = p
|
||||
sys.stdout.write('\r%s: %3d%% (%d/%d) ' % (
|
||||
self._title,
|
||||
p,
|
||||
self._done,
|
||||
self._total))
|
||||
sys.stdout.flush()
|
||||
text = '%s: %3d%% (%2d/%2d)' % (self._title, p,
|
||||
self._done, self._total)
|
||||
|
||||
if text:
|
||||
text += ' ' + extra
|
||||
spaces = max(self._width - len(text), 0)
|
||||
sys.stdout.write('%s%*s\r' % (text, spaces, ''))
|
||||
sys.stdout.flush()
|
||||
self._width = len(text)
|
||||
|
||||
def end(self):
|
||||
if not self._show:
|
||||
return
|
||||
|
||||
if self._total <= 0:
|
||||
sys.stdout.write('\r%s: %d, done. \n' % (
|
||||
sys.stdout.write('%s: %d, done.\n' % (
|
||||
self._title,
|
||||
self._done))
|
||||
sys.stdout.flush()
|
||||
else:
|
||||
p = (100 * self._done) / self._total
|
||||
sys.stdout.write('\r%s: %3d%% (%d/%d), done. \n' % (
|
||||
sys.stdout.write('%s: %3d%% (%d/%d), done.\n' % (
|
||||
self._title,
|
||||
p,
|
||||
self._done,
|
||||
|
||||
Reference in New Issue
Block a user