progress: remove progress.estimate config
authorJun Wu <quark@fb.com>
Wed, 27 Sep 2017 14:30:58 -0700
changeset 39811 f428c347d32b2f110856c6fb7fec00a5f4cc0c0d
parent 39810 d64c2c050b54794ba117d622df729679b928039f
child 39812 a667f0ca1d5fa8b80006fc4030ded936b47d3e83
push id571
push usergszorc@mozilla.com
push dateFri, 29 Sep 2017 23:16:06 +0000
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
mercurial/configitems.py
mercurial/progress.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -354,19 +354,16 @@ coreconfigitem('progress', 'debug',
     default=False,
 )
 coreconfigitem('progress', 'delay',
     default=3,
 )
 coreconfigitem('progress', 'disable',
     default=False,
 )
-coreconfigitem('progress', 'estimate',
-    default=2,
-)
 coreconfigitem('progress', 'refresh',
     default=0.1,
 )
 coreconfigitem('progress', 'width',
     default=dynamicdefault,
 )
 coreconfigitem('push', 'pushvars.server',
     default=False,
--- a/mercurial/progress.py
+++ b/mercurial/progress.py
@@ -210,29 +210,25 @@ class progbar(object):
     def estimate(self, topic, pos, total, now):
         if total is None:
             return ''
         initialpos = self.startvals[topic]
         target = total - initialpos
         delta = pos - initialpos
         if delta > 0:
             elapsed = now - self.starttimes[topic]
-            # experimental config: progress.estimate
-            if elapsed > float(
-                self.ui.config('progress', 'estimate')):
-                seconds = (elapsed * (target - delta)) // delta + 1
-                return fmtremaining(seconds)
+            seconds = (elapsed * (target - delta)) // delta + 1
+            return fmtremaining(seconds)
         return ''
 
     def speed(self, topic, pos, unit, now):
         initialpos = self.startvals[topic]
         delta = pos - initialpos
         elapsed = now - self.starttimes[topic]
-        if elapsed > float(
-            self.ui.config('progress', 'estimate')):
+        if elapsed > 0:
             return _('%d %s/sec') % (delta / elapsed, unit)
         return ''
 
     def _oktoprint(self, now):
         '''Check if conditions are met to print - e.g. changedelay elapsed'''
         if (self.lasttopic is None # first time we printed
             # not a topic change
             or self.curtopic == self.lasttopic