comparison mercurial/progress.py @ 34320:f428c347d32b

progress: remove progress.estimate config It was introduced by 98e4d39 ("progress: add speed format" 2011-5-9) and was intended to hide ETA information for the first few seconds. Later 5d261fd ("progress: add a changedelay to prevent parallel topics from flapping (issue2698)" 2011-6-23) introduced `changedelay` config which hides the entire progress bar for the first few seconds. So `progress.estimate` seems somehow duplicated feature-wise. Since it's experimental and duplicated, let's just remove it. This makes the next patch simpler - it no longer needs to make sure `starttimes` is the real start time. Differential Revision: https://phab.mercurial-scm.org/D828
author Jun Wu <quark@fb.com>
date Wed, 27 Sep 2017 14:30:58 -0700
parents 0407a51b9d8c
children a667f0ca1d5f
comparison
equal deleted inserted replaced
34319:d64c2c050b54 34320:f428c347d32b
213 initialpos = self.startvals[topic] 213 initialpos = self.startvals[topic]
214 target = total - initialpos 214 target = total - initialpos
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 seconds = (elapsed * (target - delta)) // delta + 1
219 if elapsed > float( 219 return fmtremaining(seconds)
220 self.ui.config('progress', 'estimate')):
221 seconds = (elapsed * (target - delta)) // delta + 1
222 return fmtremaining(seconds)
223 return '' 220 return ''
224 221
225 def speed(self, topic, pos, unit, now): 222 def speed(self, topic, pos, unit, now):
226 initialpos = self.startvals[topic] 223 initialpos = self.startvals[topic]
227 delta = pos - initialpos 224 delta = pos - initialpos
228 elapsed = now - self.starttimes[topic] 225 elapsed = now - self.starttimes[topic]
229 if elapsed > float( 226 if elapsed > 0:
230 self.ui.config('progress', 'estimate')):
231 return _('%d %s/sec') % (delta / elapsed, unit) 227 return _('%d %s/sec') % (delta / elapsed, unit)
232 return '' 228 return ''
233 229
234 def _oktoprint(self, now): 230 def _oktoprint(self, now):
235 '''Check if conditions are met to print - e.g. changedelay elapsed''' 231 '''Check if conditions are met to print - e.g. changedelay elapsed'''