Fix coloring madness in depot_tools.
'setup_color' now contains logic to correctly detect:
* cmd
* cmd pipe
* msys bash
* msys pipe
* cmd running inside msys bash (git-command)
* cmd pipe running inside msys bash (git-command > outfile)
R=brucedawson@chromium.org, dnj@chromium.org
BUG=600049
Review URL: https://codereview.chromium.org/1851283002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299682 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_common.py b/git_common.py
index 949ba46..bef628e 100644
--- a/git_common.py
+++ b/git_common.py
@@ -22,6 +22,7 @@
import logging
import os
import re
+import setup_color
import shutil
import signal
import sys
@@ -281,7 +282,7 @@
## Git functions
-def blame(filename, revision=None, porcelain=False, *args):
+def blame(filename, revision=None, porcelain=False, *_args):
command = ['blame']
if porcelain:
command.append('-p')
@@ -576,7 +577,7 @@
Automatically checks if sys.stdout is a non-TTY stream. If so, it avoids
running less and just yields sys.stdout.
"""
- if not sys.stdout.isatty():
+ if not setup_color.IS_TTY:
yield sys.stdout
return