Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: third_party/repo/progress.py

Issue 227163002: Revamped terminal output for update. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: rebase Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « tests/gclient_test.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # 1 #
2 # Copyright (C) 2009 The Android Open Source Project 2 # Copyright (C) 2009 The Android Open Source Project
3 # 3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License. 5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at 6 # You may obtain a copy of the License at
7 # 7 #
8 # http://www.apache.org/licenses/LICENSE-2.0 8 # http://www.apache.org/licenses/LICENSE-2.0
9 # 9 #
10 # Unless required by applicable law or agreed to in writing, software 10 # Unless required by applicable law or agreed to in writing, software
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 spaces = max(self._width - len(text), 0) 52 spaces = max(self._width - len(text), 0)
53 sys.stdout.write('%s%*s\r' % (text, spaces, '')) 53 sys.stdout.write('%s%*s\r' % (text, spaces, ''))
54 sys.stdout.flush() 54 sys.stdout.flush()
55 self._width = len(text) 55 self._width = len(text)
56 56
57 def end(self): 57 def end(self):
58 if not self._show: 58 if not self._show:
59 return 59 return
60 60
61 if self._total <= 0: 61 if self._total <= 0:
62 sys.stdout.write('%s: %d, done.\n' % ( 62 text = '%s: %d, done.' % (
63 self._title, 63 self._title,
64 self._done)) 64 self._done)
65 sys.stdout.flush()
66 else: 65 else:
67 p = (100 * self._done) / self._total 66 p = (100 * self._done) / self._total
68 sys.stdout.write('%s: %3d%% (%d/%d), done.\n' % ( 67 text = '%s: %3d%% (%d/%d), done.' % (
69 self._title, 68 self._title,
70 p, 69 p,
71 self._done, 70 self._done,
72 self._total)) 71 self._total)
73 sys.stdout.flush() 72
73 spaces = max(self._width - len(text), 0)
74 sys.stdout.write('%s%*s\n' % (text, spaces, ''))
75 sys.stdout.flush()
OLDNEW
« no previous file with comments | « tests/gclient_test.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698