hgext/progress.py
branchstable
changeset 15662 06671371e634
parent 14838 5d261fd00446
child 15772 83a140752239
equal deleted inserted replaced
15661:20ae902c43ec 15662:06671371e634
   269 def uisetup(ui):
   269 def uisetup(ui):
   270     global _singleton
   270     global _singleton
   271     class progressui(ui.__class__):
   271     class progressui(ui.__class__):
   272         _progbar = None
   272         _progbar = None
   273 
   273 
       
   274         def _quiet(self):
       
   275             return self.debugflag or self.quiet
       
   276 
   274         def progress(self, *args, **opts):
   277         def progress(self, *args, **opts):
   275             self._progbar.progress(*args, **opts)
   278             if not self._quiet():
       
   279                 self._progbar.progress(*args, **opts)
   276             return super(progressui, self).progress(*args, **opts)
   280             return super(progressui, self).progress(*args, **opts)
   277 
   281 
   278         def write(self, *args, **opts):
   282         def write(self, *args, **opts):
   279             if self._progbar.printed:
   283             if not self._quiet() and self._progbar.printed:
   280                 self._progbar.clear()
   284                 self._progbar.clear()
   281             return super(progressui, self).write(*args, **opts)
   285             return super(progressui, self).write(*args, **opts)
   282 
   286 
   283         def write_err(self, *args, **opts):
   287         def write_err(self, *args, **opts):
   284             if self._progbar.printed:
   288             if not self._quiet() and self._progbar.printed:
   285                 self._progbar.clear()
   289                 self._progbar.clear()
   286             return super(progressui, self).write_err(*args, **opts)
   290             return super(progressui, self).write_err(*args, **opts)
   287 
   291 
   288     # Apps that derive a class from ui.ui() can use
   292     # Apps that derive a class from ui.ui() can use
   289     # setconfig('progress', 'disable', 'True') to disable this extension
   293     # setconfig('progress', 'disable', 'True') to disable this extension