Make 'gclient update' and 'gclient status' quieter by default - they don't
print messages unless the underlying commands actually generate output.
This is a more conservative version of r28271.
BUG=none
TEST=none
R=maruel
Review URL: http://codereview.chromium.org/344004
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@30296 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gclient_utils.py b/gclient_utils.py
index 464419f..8b4eeb2 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -183,8 +183,13 @@
"""Runs command, a list, in directory in_directory.
If print_messages is true, a message indicating what is being done
- is printed to stdout. If print_stdout is true, the command's stdout
- is also forwarded to stdout.
+ is printed to stdout. If print_messages is false, the message is printed
+ only if we actually need to print something else as well, so you can
+ get the context of the output. If print_messages is false and print_stdout
+ is false, no output at all is generated.
+
+ Also, if print_stdout is true, the command's stdout is also forwarded
+ to stdout.
If a filter function is specified, it is expected to take a single
string argument, and it will be called with each line of the
@@ -216,6 +221,10 @@
if in_byte != "\r":
if print_stdout:
sys.stdout.write(in_byte)
+ if not print_messages:
+ print("\n________ running \'%s\' in \'%s\'"
+ % (' '.join(command), in_directory))
+ print_messages = True
if in_byte != "\n":
in_line += in_byte
if in_byte == "\n" and filter: