Show More
@@ -37,9 +37,9 b' The following settings are available::' | |||||
37 | # disable is given |
|
37 | # disable is given | |
38 |
|
38 | |||
39 | Valid entries for the format field are topic, bar, number, unit, |
|
39 | Valid entries for the format field are topic, bar, number, unit, | |
40 |
estimate, and item. item defaults to the last 20 characters of |
|
40 | estimate, speed, and item. item defaults to the last 20 characters of | |
41 |
item, but this can be changed by adding either ``-<num>`` which |
|
41 | the item, but this can be changed by adding either ``-<num>`` which | |
42 | take the last num characters, or ``+<num>`` for the first num |
|
42 | would take the last num characters, or ``+<num>`` for the first num | |
43 | characters. |
|
43 | characters. | |
44 | """ |
|
44 | """ | |
45 |
|
45 | |||
@@ -151,6 +151,8 b' class progbar(object):' | |||||
151 | add = unit |
|
151 | add = unit | |
152 | elif indicator == 'estimate': |
|
152 | elif indicator == 'estimate': | |
153 | add = self.estimate(topic, pos, total, now) |
|
153 | add = self.estimate(topic, pos, total, now) | |
|
154 | elif indicator == 'speed': | |||
|
155 | add = self.speed(topic, pos, unit, now) | |||
154 | if not needprogress: |
|
156 | if not needprogress: | |
155 | head = spacejoin(head, add) |
|
157 | head = spacejoin(head, add) | |
156 | else: |
|
158 | else: | |
@@ -216,6 +218,15 b' class progbar(object):' | |||||
216 | return fmtremaining(seconds) |
|
218 | return fmtremaining(seconds) | |
217 | return '' |
|
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 | def progress(self, topic, pos, item='', unit='', total=None): |
|
230 | def progress(self, topic, pos, item='', unit='', total=None): | |
220 | now = time.time() |
|
231 | now = time.time() | |
221 | if pos is None: |
|
232 | if pos is None: |
General Comments 0
You need to be logged in to leave comments.
Login now