Show More
@@ -37,9 +37,9 b' The following settings are available::' | |||
|
37 | 37 | # disable is given |
|
38 | 38 | |
|
39 | 39 | Valid entries for the format field are topic, bar, number, unit, |
|
40 |
estimate, and item. item defaults to the last 20 characters of |
|
|
41 |
item, but this can be changed by adding either ``-<num>`` which |
|
|
42 | take the last num characters, or ``+<num>`` for the first num | |
|
40 | estimate, speed, and item. item defaults to the last 20 characters of | |
|
41 | the item, but this can be changed by adding either ``-<num>`` which | |
|
42 | would take the last num characters, or ``+<num>`` for the first num | |
|
43 | 43 | characters. |
|
44 | 44 | """ |
|
45 | 45 | |
@@ -151,6 +151,8 b' class progbar(object):' | |||
|
151 | 151 | add = unit |
|
152 | 152 | elif indicator == 'estimate': |
|
153 | 153 | add = self.estimate(topic, pos, total, now) |
|
154 | elif indicator == 'speed': | |
|
155 | add = self.speed(topic, pos, unit, now) | |
|
154 | 156 | if not needprogress: |
|
155 | 157 | head = spacejoin(head, add) |
|
156 | 158 | else: |
@@ -216,6 +218,15 b' class progbar(object):' | |||
|
216 | 218 | return fmtremaining(seconds) |
|
217 | 219 | return '' |
|
218 | 220 | |
|
221 | def speed(self, topic, pos, unit, now): | |
|
222 | initialpos = self.startvals[topic] | |
|
223 | delta = pos - initialpos | |
|
224 | elapsed = now - self.starttimes[topic] | |
|
225 | if elapsed > float( | |
|
226 | self.ui.config('progress', 'estimate', default=2)): | |
|
227 | return _('%d %s/sec') % (delta / elapsed, unit) | |
|
228 | return '' | |
|
229 | ||
|
219 | 230 | def progress(self, topic, pos, item='', unit='', total=None): |
|
220 | 231 | now = time.time() |
|
221 | 232 | if pos is None: |
General Comments 0
You need to be logged in to leave comments.
Login now