progress: check for ui.quiet and ui.debugflag before we write stable
authorDavid Soria Parra <dsp@php.net>
Wed, 14 Dec 2011 15:41:08 +0100
branchstable
changeset 15662 06671371e634
parent 15661 20ae902c43ec
child 15663 9036c7d106bf
progress: check for ui.quiet and ui.debugflag before we write ui.quiet and ui.debugflag are not initialized during uisetup and reposetup. progressui is always initialized, therefore we have to check during write() if ui.quiet is set or not.
hgext/progress.py
--- a/hgext/progress.py	Fri Dec 16 18:23:15 2011 -0600
+++ b/hgext/progress.py	Wed Dec 14 15:41:08 2011 +0100
@@ -271,17 +271,21 @@
     class progressui(ui.__class__):
         _progbar = None
 
+        def _quiet(self):
+            return self.debugflag or self.quiet
+
         def progress(self, *args, **opts):
-            self._progbar.progress(*args, **opts)
+            if not self._quiet():
+                self._progbar.progress(*args, **opts)
             return super(progressui, self).progress(*args, **opts)
 
         def write(self, *args, **opts):
-            if self._progbar.printed:
+            if not self._quiet() and self._progbar.printed:
                 self._progbar.clear()
             return super(progressui, self).write(*args, **opts)
 
         def write_err(self, *args, **opts):
-            if self._progbar.printed:
+            if not self._quiet() and self._progbar.printed:
                 self._progbar.clear()
             return super(progressui, self).write_err(*args, **opts)