changeset 11326:c89309fa907d

color: use ui.formatted().
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Mon, 07 Jun 2010 15:28:54 +0200
parents 22a737306ba5
children 6c469f2f9f12
files hgext/color.py
diffstat 1 files changed, 1 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/color.py	Mon Jun 07 16:14:12 2010 +0200
+++ b/hgext/color.py	Mon Jun 07 15:28:54 2010 +0200
@@ -198,14 +198,10 @@
         _effects.update(w32effects)
     elif mode != 'ansi':
         return
-
-    # check isatty() before anything else changes it (like pager)
-    isatty = sys.__stdout__.isatty()
-
     def colorcmd(orig, ui_, opts, cmd, cmdfunc):
         if (opts['color'] == 'always' or
             (opts['color'] == 'auto' and (os.environ.get('TERM') != 'dumb'
-                                          and isatty))):
+                                          and ui_.formatted()))):
             global _buffers
             _buffers = ui_._buffers
             extensions.wrapfunction(ui_, 'popbuffer', popbuffer)