progress: respect ui.quiet (issue4726)
authorAugie Fackler <augie@google.com>
Tue, 16 Jun 2015 14:11:58 -0400
changeset 25581 79c75459321e
parent 25580 a69983942fb4
child 25582 5fa399a0c385
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.
mercurial/progress.py
tests/test-progress.t
--- a/mercurial/progress.py	Mon Jun 15 13:31:22 2015 -0500
+++ b/mercurial/progress.py	Tue Jun 16 14:11:58 2015 -0400
@@ -17,8 +17,8 @@
     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 @@
                         self.show(now, topic, *self.topicstates[topic])
         finally:
             self._refreshlock.release()
-
--- a/tests/test-progress.t	Mon Jun 15 13:31:22 2015 -0500
+++ b/tests/test-progress.t	Tue Jun 16 14:11:58 2015 -0400
@@ -76,7 +76,8 @@
   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):