Show More
@@ -55,6 +55,19 b' def shouldprint(ui):' | |||||
55 | return (getattr(sys.stderr, 'isatty', None) and |
|
55 | return (getattr(sys.stderr, 'isatty', None) and | |
56 | (sys.stderr.isatty() or ui.configbool('progress', 'assume-tty'))) |
|
56 | (sys.stderr.isatty() or ui.configbool('progress', 'assume-tty'))) | |
57 |
|
57 | |||
|
58 | def fmtremaining(seconds): | |||
|
59 | if seconds < 60: | |||
|
60 | return _("%02ds") % (seconds) | |||
|
61 | minutes = seconds // 60 | |||
|
62 | if minutes < 60: | |||
|
63 | seconds -= minutes * 60 | |||
|
64 | return _("%dm%02ds") % (minutes, seconds) | |||
|
65 | # we're going to ignore seconds in this case | |||
|
66 | minutes += 1 | |||
|
67 | hours = minutes // 60 | |||
|
68 | minutes -= hours * 60 | |||
|
69 | return _("%dh%02dm") % (hours, minutes) | |||
|
70 | ||||
58 | class progbar(object): |
|
71 | class progbar(object): | |
59 | def __init__(self, ui): |
|
72 | def __init__(self, ui): | |
60 | self.ui = ui |
|
73 | self.ui = ui | |
@@ -132,16 +145,7 b' class progbar(object):' | |||||
132 | if elapsed > float( |
|
145 | if elapsed > float( | |
133 | self.ui.config('progress', 'estimate', default=2)): |
|
146 | self.ui.config('progress', 'estimate', default=2)): | |
134 | seconds = (elapsed * (target - delta)) // delta + 1 |
|
147 | seconds = (elapsed * (target - delta)) // delta + 1 | |
135 |
|
|
148 | remaining = fmtremaining(seconds) | |
136 | if minutes < 10: |
|
|||
137 | seconds -= minutes * 60 |
|
|||
138 | remaining = _("%dm%02ds") % (minutes, seconds) |
|
|||
139 | else: |
|
|||
140 | # we're going to ignore seconds in this case |
|
|||
141 | minutes += 1 |
|
|||
142 | hours = minutes // 60 |
|
|||
143 | minutes -= hours * 60 |
|
|||
144 | remaining = _("%dh%02dm") % (hours, minutes) |
|
|||
145 | progwidth -= len(remaining) + 1 |
|
149 | progwidth -= len(remaining) + 1 | |
146 | tail = spacejoin(tail, remaining) |
|
150 | tail = spacejoin(tail, remaining) | |
147 | amt = pos * progwidth // total |
|
151 | amt = pos * progwidth // total |
General Comments 0
You need to be logged in to leave comments.
Login now