diff options
| author | Tim Schumacher <timschumi2@arcor.de> | 2017-06-05 15:01:41 +0200 |
|---|---|---|
| committer | Tim Schumacher <timschumi2@arcor.de> | 2017-06-13 13:03:39 +0200 |
| commit | 913327f10c73c53edca6421a48c116b87b207b15 (patch) | |
| tree | 308e308ea5ab4d0cf396a814952983600e063bde | |
| parent | 35d22217a5ed2f8b5b9b183217923071ccfe7f37 (diff) | |
| download | git-repo-913327f10c73c53edca6421a48c116b87b207b15.tar.gz | |
Add a newline after "Fetching projects" progress output
Output before change:
Fetching project platform/packages/providers/UserDictionaryProvider
Fetching projects: 66% (773/1171) Fetching project platform/external/regex-re2
Fetching project device/generic/mini-emulator-x86_64
Output after change:
Fetching project platform/packages/providers/UserDictionaryProvider
Fetching projects: 66% (773/1171)
Fetching project platform/external/regex-re2
Fetching project device/generic/mini-emulator-x86_64
Change-Id: I4da84da58316c69294e4da2792f83885dc942701
| -rw-r--r-- | progress.py | 8 | ||||
| -rw-r--r-- | subcmds/sync.py | 3 |
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 | ||
| 23 | class Progress(object): | 23 | class 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 ef023274..eabe16aa 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: |
