Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/progress.py @ 33250:bbc57a7e8823
configitems: register the 'progress.estimate' config
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 30 Jun 2017 03:44:04 +0200 |
parents | 391da1416038 |
children | 0407a51b9d8c |
comparison
equal
deleted
inserted
replaced
33249:391da1416038 | 33250:bbc57a7e8823 |
---|---|
215 delta = pos - initialpos | 215 delta = pos - initialpos |
216 if delta > 0: | 216 if delta > 0: |
217 elapsed = now - self.starttimes[topic] | 217 elapsed = now - self.starttimes[topic] |
218 # experimental config: progress.estimate | 218 # experimental config: progress.estimate |
219 if elapsed > float( | 219 if elapsed > float( |
220 self.ui.config('progress', 'estimate', default=2)): | 220 self.ui.config('progress', 'estimate')): |
221 seconds = (elapsed * (target - delta)) // delta + 1 | 221 seconds = (elapsed * (target - delta)) // delta + 1 |
222 return fmtremaining(seconds) | 222 return fmtremaining(seconds) |
223 return '' | 223 return '' |
224 | 224 |
225 def speed(self, topic, pos, unit, now): | 225 def speed(self, topic, pos, unit, now): |
226 initialpos = self.startvals[topic] | 226 initialpos = self.startvals[topic] |
227 delta = pos - initialpos | 227 delta = pos - initialpos |
228 elapsed = now - self.starttimes[topic] | 228 elapsed = now - self.starttimes[topic] |
229 if elapsed > float( | 229 if elapsed > float( |
230 self.ui.config('progress', 'estimate', default=2)): | 230 self.ui.config('progress', 'estimate')): |
231 return _('%d %s/sec') % (delta / elapsed, unit) | 231 return _('%d %s/sec') % (delta / elapsed, unit) |
232 return '' | 232 return '' |
233 | 233 |
234 def _oktoprint(self, now): | 234 def _oktoprint(self, now): |
235 '''Check if conditions are met to print - e.g. changedelay elapsed''' | 235 '''Check if conditions are met to print - e.g. changedelay elapsed''' |