[PATCH progress-quiet] progress: respect ui.quiet (issue4726)

Augie Fackler raf at durin42.com
Tue Jun 16 13:13:53 CDT 2015


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1434478318 14400
#      Tue Jun 16 14:11:58 2015 -0400
# Node ID 5536d77cdfb68e172113ef6dd4c631bcf613e853
# Parent  4388714b846e21cb2fefb686220c7c0d2df1b85a
progress: respect ui.quiet (issue4726)

Caught when I was running the hgsubversion testsuite and it started
printing progress bars over top of my test output lines.

diff --git a/mercurial/progress.py b/mercurial/progress.py
--- a/mercurial/progress.py
+++ b/mercurial/progress.py
@@ -17,8 +17,8 @@ def spacejoin(*args):
     return ' '.join(s for s in args if s)
 
 def shouldprint(ui):
-    return not ui.plain() and (ui._isatty(sys.stderr) or
-                               ui.configbool('progress', 'assume-tty'))
+    return not (ui.quiet or ui.plain()) and (
+        ui._isatty(sys.stderr) or ui.configbool('progress', 'assume-tty'))
 
 def fmtremaining(seconds):
     """format a number of remaining seconds in humain readable way
@@ -249,4 +249,3 @@ class progbar(object):
                         self.show(now, topic, *self.topicstates[topic])
         finally:
             self._refreshlock.release()
-
diff --git a/tests/test-progress.t b/tests/test-progress.t
--- a/tests/test-progress.t
+++ b/tests/test-progress.t
@@ -76,7 +76,8 @@ test with delay=0, refresh=0
   loop [===============>                                ] 1/3\r (no-eol) (esc)
   loop [===============================>                ] 2/3\r (no-eol) (esc)
                                                               \r (no-eol) (esc)
-
+no progress with --quiet
+  $ hg -y loop 3 --quiet
 
 test nested short-lived topics (which shouldn't display with nestdelay):
 


More information about the Mercurial-devel mailing list