diff hgext/progress.py @ 15662:06671371e634 stable

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.
author David Soria Parra <dsp@php.net>
date Wed, 14 Dec 2011 15:41:08 +0100
parents 5d261fd00446
children 83a140752239
line wrap: on
line diff
--- 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)