mercurial/progress.py
changeset 38417 6bd9f18d31a8
parent 36423 2831d918e1b4
child 38418 b34d0a6ef936
equal deleted inserted replaced
38416:35b50237908b 38417:6bd9f18d31a8
   263             self.startvals[topic] = pos - newdelta
   263             self.startvals[topic] = pos - newdelta
   264             self.starttimes[topic] = now - interval
   264             self.starttimes[topic] = now - interval
   265 
   265 
   266     def progress(self, topic, pos, item='', unit='', total=None):
   266     def progress(self, topic, pos, item='', unit='', total=None):
   267         now = time.time()
   267         now = time.time()
   268         self._refreshlock.acquire()
   268         with self._refreshlock:
   269         try:
       
   270             if pos is None:
   269             if pos is None:
   271                 self.starttimes.pop(topic, None)
   270                 self.starttimes.pop(topic, None)
   272                 self.startvals.pop(topic, None)
   271                 self.startvals.pop(topic, None)
   273                 self.topicstates.pop(topic, None)
   272                 self.topicstates.pop(topic, None)
   274                 # reset the progress bar if this is the outermost topic
   273                 # reset the progress bar if this is the outermost topic
   296                 self._calibrateestimate(topic, now, pos)
   295                 self._calibrateestimate(topic, now, pos)
   297                 if now - self.lastprint >= self.refresh and self.topics:
   296                 if now - self.lastprint >= self.refresh and self.topics:
   298                     if self._oktoprint(now):
   297                     if self._oktoprint(now):
   299                         self.lastprint = now
   298                         self.lastprint = now
   300                         self.show(now, topic, *self.topicstates[topic])
   299                         self.show(now, topic, *self.topicstates[topic])
   301         finally:
       
   302             self._refreshlock.release()