mercurial/progress.py
changeset 33250 bbc57a7e8823
parent 33249 391da1416038
child 33499 0407a51b9d8c
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'''