summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Pursehouse <dpursehouse@collab.net>2017-06-28 04:24:03 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2017-06-28 04:24:03 +0000
commit259f16520acafbe85ee68deb43fa74ae56e1c617 (patch)
tree4d02a1ae04b78863e7e295dff8b949a00e719b21
parent8419ab22d69ed0d89809f322aef16105ad6bb127 (diff)
parent913327f10c73c53edca6421a48c116b87b207b15 (diff)
downloadgit-repo-259f16520acafbe85ee68deb43fa74ae56e1c617.tar.gz
Merge "Add a newline after "Fetching projects" progress output"
-rw-r--r--progress.py8
-rw-r--r--subcmds/sync.py3
2 files changed, 7 insertions, 4 deletions
diff --git a/progress.py b/progress.py
index d948654f..b08f52e5 100644
--- a/progress.py
+++ b/progress.py
@@ -21,7 +21,7 @@ from trace import IsTrace
21_NOT_TTY = not os.isatty(2) 21_NOT_TTY = not os.isatty(2)
22 22
23class Progress(object): 23class Progress(object):
24 def __init__(self, title, total=0, units=''): 24 def __init__(self, title, total=0, units='', print_newline=False):
25 self._title = title 25 self._title = title
26 self._total = total 26 self._total = total
27 self._done = 0 27 self._done = 0
@@ -29,6 +29,7 @@ class Progress(object):
29 self._start = time() 29 self._start = time()
30 self._show = False 30 self._show = False
31 self._units = units 31 self._units = units
32 self._print_newline = print_newline
32 33
33 def update(self, inc=1): 34 def update(self, inc=1):
34 self._done += inc 35 self._done += inc
@@ -52,11 +53,12 @@ class Progress(object):
52 53
53 if self._lastp != p: 54 if self._lastp != p:
54 self._lastp = p 55 self._lastp = p
55 sys.stderr.write('\r%s: %3d%% (%d%s/%d%s) ' % ( 56 sys.stderr.write('\r%s: %3d%% (%d%s/%d%s)%s' % (
56 self._title, 57 self._title,
57 p, 58 p,
58 self._done, self._units, 59 self._done, self._units,
59 self._total, self._units)) 60 self._total, self._units,
61 "\n" if self._print_newline else ""))
60 sys.stderr.flush() 62 sys.stderr.flush()
61 63
62 def end(self): 64 def end(self):
diff --git a/subcmds/sync.py b/subcmds/sync.py
index 2d00eb7d..d4432ce8 100644
--- a/subcmds/sync.py
+++ b/subcmds/sync.py
@@ -356,7 +356,8 @@ later is required to fix a server side protocol bug.
356 def _Fetch(self, projects, opt): 356 def _Fetch(self, projects, opt):
357 fetched = set() 357 fetched = set()
358 lock = _threading.Lock() 358 lock = _threading.Lock()
359 pm = Progress('Fetching projects', len(projects)) 359 pm = Progress('Fetching projects', len(projects),
360 print_newline=not(opt.quiet))
360 361
361 objdir_project_map = dict() 362 objdir_project_map = dict()
362 for project in projects: 363 for project in projects: