[PATCH] progress: check for ui.quiet and ui.debugflag before we write

David Soria Parra dsp at php.net
Wed Dec 14 08:42:02 CST 2011


# HG changeset patch
# User David Soria Parra <dsp at php.net>
# Date 1323873668 -3600
# Node ID a12cd047920cf4a8135086b66112bcae622048b0
# Parent  e6868bd17f24324db347a289bb2ae0120dd5cd54
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.

diff --git a/hgext/progress.py b/hgext/progress.py
--- a/hgext/progress.py
+++ b/hgext/progress.py
@@ -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)
 


More information about the Mercurial-devel mailing list