mirror of
https://gerrit.googlesource.com/git-repo
synced 2024-12-21 07:16:21 +00:00
Merge "Always print percentage when syncing quietly"
This commit is contained in:
commit
8a6eeed7f5
@ -21,7 +21,8 @@ from trace import IsTrace
|
|||||||
_NOT_TTY = not os.isatty(2)
|
_NOT_TTY = not os.isatty(2)
|
||||||
|
|
||||||
class Progress(object):
|
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._title = title
|
||||||
self._total = total
|
self._total = total
|
||||||
self._done = 0
|
self._done = 0
|
||||||
@ -30,6 +31,7 @@ class Progress(object):
|
|||||||
self._show = False
|
self._show = False
|
||||||
self._units = units
|
self._units = units
|
||||||
self._print_newline = print_newline
|
self._print_newline = print_newline
|
||||||
|
self._always_print_percentage = always_print_percentage
|
||||||
|
|
||||||
def update(self, inc=1):
|
def update(self, inc=1):
|
||||||
self._done += inc
|
self._done += inc
|
||||||
@ -51,7 +53,7 @@ class Progress(object):
|
|||||||
else:
|
else:
|
||||||
p = (100 * self._done) / self._total
|
p = (100 * self._done) / self._total
|
||||||
|
|
||||||
if self._lastp != p:
|
if self._lastp != p or self._always_print_percentage:
|
||||||
self._lastp = p
|
self._lastp = p
|
||||||
sys.stderr.write('\r%s: %3d%% (%d%s/%d%s)%s' % (
|
sys.stderr.write('\r%s: %3d%% (%d%s/%d%s)%s' % (
|
||||||
self._title,
|
self._title,
|
||||||
|
@ -357,7 +357,8 @@ later is required to fix a server side protocol bug.
|
|||||||
fetched = set()
|
fetched = set()
|
||||||
lock = _threading.Lock()
|
lock = _threading.Lock()
|
||||||
pm = Progress('Fetching projects', len(projects),
|
pm = Progress('Fetching projects', len(projects),
|
||||||
print_newline=not(opt.quiet))
|
print_newline=not(opt.quiet),
|
||||||
|
always_print_percentage=opt.quiet)
|
||||||
|
|
||||||
objdir_project_map = dict()
|
objdir_project_map = dict()
|
||||||
for project in projects:
|
for project in projects:
|
||||||
|
Loading…
Reference in New Issue
Block a user