aboutsummaryrefslogtreecommitdiff
path: root/progress.py
diff options
context:
space:
mode:
authorTim Schumacher <timschumi2@arcor.de>2017-06-28 18:29:23 +0200
committerTim Schumacher <timschumi2@arcor.de>2017-07-15 16:44:55 +0000
commit7be072efa6522a94ee0bab16539a442cc4713d65 (patch)
tree96c5577a829b6df2e7b2fd5f6ea35e7ba6177a26 /progress.py
parent224a31a765eb943443640301a715d2d4eb005b79 (diff)
downloadrepo-7be072efa6522a94ee0bab16539a442cc4713d65.tar.gz
Always print percentage when syncing quietly
Change-Id: I574396e63520781067ed1e991c41caf7640e5731
Diffstat (limited to 'progress.py')
-rw-r--r--progress.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/progress.py b/progress.py
index b08f52e..0dd5d1a 100644
--- a/progress.py
+++ b/progress.py
@@ -21,7 +21,8 @@ from trace import IsTrace
_NOT_TTY = not os.isatty(2)
class Progress(object):
- def __init__(self, title, total=0, units='', print_newline=False):
+ def __init__(self, title, total=0, units='', print_newline=False,
+ always_print_percentage=False):
self._title = title
self._total = total
self._done = 0
@@ -30,6 +31,7 @@ class Progress(object):
self._show = False
self._units = units
self._print_newline = print_newline
+ self._always_print_percentage = always_print_percentage
def update(self, inc=1):
self._done += inc
@@ -51,7 +53,7 @@ class Progress(object):
else:
p = (100 * self._done) / self._total
- if self._lastp != p:
+ if self._lastp != p or self._always_print_percentage:
self._lastp = p
sys.stderr.write('\r%s: %3d%% (%d%s/%d%s)%s' % (
self._title,