mercurial/scmutil.py
changeset 41143 7b80406b8271
parent 41142 8cf92ca92bfe
child 41144 3025fd3c2e71
equal deleted inserted replaced
41142:8cf92ca92bfe 41143:7b80406b8271
  1419         self.ui = ui
  1419         self.ui = ui
  1420         self.pos = 0
  1420         self.pos = 0
  1421         self.topic = topic
  1421         self.topic = topic
  1422         self.unit = unit
  1422         self.unit = unit
  1423         self.total = total
  1423         self.total = total
       
  1424         self.debug = ui.configbool('progress', 'debug')
  1424 
  1425 
  1425     def __enter__(self):
  1426     def __enter__(self):
  1426         return self
  1427         return self
  1427 
  1428 
  1428     def __exit__(self, exc_type, exc_value, exc_tb):
  1429     def __exit__(self, exc_type, exc_value, exc_tb):
  1456                                    total=self.total)
  1457                                    total=self.total)
  1457         elif self.ui._progbar is not None:
  1458         elif self.ui._progbar is not None:
  1458             self.ui._progbar.progress(self.topic, self.pos, item=item,
  1459             self.ui._progbar.progress(self.topic, self.pos, item=item,
  1459                                       unit=self.unit, total=self.total)
  1460                                       unit=self.unit, total=self.total)
  1460 
  1461 
  1461             # Looking up progress.debug in tight loops is expensive. The value
  1462         if self.pos is None or not self.debug:
  1462             # is cached on the progbar object and we can avoid the lookup in
       
  1463             # the common case where a progbar is active.
       
  1464             if self.pos is None or not self.ui._progbar.debug:
       
  1465                 return
       
  1466 
       
  1467         # Keep this logic in sync with above.
       
  1468         if self.pos is None or not self.ui.configbool('progress', 'debug'):
       
  1469             return
  1463             return
  1470 
  1464 
  1471         if self.unit:
  1465         if self.unit:
  1472             unit = ' ' + self.unit
  1466             unit = ' ' + self.unit
  1473         if item:
  1467         if item: