Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Unified Diff: git_cl.py

Issue 1851283002: Fix coloring madness in depot_tools. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Improve logic a bit Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gclient.py ('k') | git_common.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_cl.py
diff --git a/git_cl.py b/git_cl.py
index 4c6bb10ce6f356b2a94d2f1c912198ca13c1ecf9..49891fcf5c8af98c55f830f6292bd018b23573d9 100755
--- a/git_cl.py
+++ b/git_cl.py
@@ -45,6 +45,7 @@ from luci_hacks import trigger_luci_job as luci_trigger
import clang_format
import commit_queue
import dart_format
+import setup_color
import fix_encoding
import gclient_utils
import gerrit_util
@@ -2481,7 +2482,7 @@ def CMDstatus(parser, args):
issue_url, status = branch_statuses.pop(branch)
color = color_for_status(status)
reset = Fore.RESET
- if not sys.stdout.isatty():
+ if not setup_color.IS_TTY:
color = ''
reset = ''
status_str = '(%s)' % status if status else ''
@@ -4181,7 +4182,7 @@ def CMDtry_results(parser, args):
group.add_option(
"--print-master", action='store_true', help="print master name as well.")
group.add_option(
- "--color", action='store_true', default=sys.stdout.isatty(),
+ "--color", action='store_true', default=setup_color.IS_TTY,
help="force color output, useful when piping output.")
group.add_option(
"--buildbucket-host", default='cr-buildbucket.appspot.com',
@@ -4615,7 +4616,7 @@ if __name__ == '__main__':
# These affect sys.stdout so do it outside of main() to simplify mocks in
# unit testing.
fix_encoding.fix_encoding()
- colorama.init(wrap="TERM" not in os.environ)
+ setup_color.init()
try:
sys.exit(main(sys.argv[1:]))
except KeyboardInterrupt:
« no previous file with comments | « gclient.py ('k') | git_common.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698