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

login
register
mail settings
Submitter Augie Fackler
Date June 16, 2015, 6:13 p.m.
Message ID <5536d77cdfb68e172113.1434478433@augie-macbookair2.roam.corp.google.com>
Download mbox | patch
Permalink /patch/9679/
State Accepted
Headers show

Comments

Augie Fackler - June 16, 2015, 6:13 p.m.
# HG changeset patch
# User Augie Fackler <augie@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.
Pierre-Yves David - June 16, 2015, 7:20 p.m.
On 06/16/2015 11:13 AM, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1434478318 14400
> #      Tue Jun 16 14:11:58 2015 -0400
> # Node ID 5536d77cdfb68e172113ef6dd4c631bcf613e853
> # Parent  4388714b846e21cb2fefb686220c7c0d2df1b85a
> progress: respect ui.quiet (issue4726)

Sure, pushed to the clowncopter.

Patch

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):