From b4d6a1c5539886c10f4d3965bd62afc793d8e912 Mon Sep 17 00:00:00 2001 From: Catalin Marinas Date: Tue, 5 Dec 2006 22:07:22 +0000 Subject: [PATCH] Only print the progress message if on a TTY The "Checking for changes..." message should only be printed if stdout is a TTY to avoid unnecessary information for people redirecting the output to a file. Signed-off-by: Catalin Marinas --- stgit/git.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/stgit/git.py b/stgit/git.py index 0e83ffc..984b749 100644 --- a/stgit/git.py +++ b/stgit/git.py @@ -185,10 +185,9 @@ def __tree_status(files = None, tree_id = 'HEAD', unknown = False, noexclude = True, verbose = False): """Returns a list of pairs - [status, filename] """ - if verbose: - print >> sys.stderr, \ - 'Checking for changes in the working directory...', - sys.stderr.flush() + if verbose and sys.stdout.isatty(): + print 'Checking for changes in the working directory...', + sys.stdout.flush() refresh_index() @@ -226,8 +225,8 @@ def __tree_status(files = None, tree_id = 'HEAD', unknown = False, if fs[1] not in conflicts: cache_files.append(fs) - if verbose: - print >> sys.stderr, 'done' + if verbose and sys.stdout.isatty(): + print 'done' return cache_files -- 2.11.0