Mercurial > hg
comparison mercurial/color.py @ 34645:75979c8d4572
codemod: use pycompat.iswindows
This is done by:
sed -i "s/pycompat\.osname == 'nt'/pycompat.iswindows/" **/*.py
sed -i "s/pycompat\.osname != 'nt'/not pycompat.iswindows/" **/*.py
sed -i 's/pycompat.osname == "nt"/pycompat.iswindows/' **/*.py
Differential Revision: https://phab.mercurial-scm.org/D1034
author | Jun Wu <quark@fb.com> |
---|---|
date | Thu, 12 Oct 2017 23:30:46 -0700 |
parents | a57c938e7ac8 |
children | d4805a5e7e70 |
comparison
equal
deleted
inserted
replaced
34644:c0a6c19690ff | 34645:75979c8d4572 |
---|---|
208 # If pager is active, color.pagermode overrides color.mode. | 208 # If pager is active, color.pagermode overrides color.mode. |
209 if getattr(ui, 'pageractive', False): | 209 if getattr(ui, 'pageractive', False): |
210 mode = ui.config('color', 'pagermode', mode) | 210 mode = ui.config('color', 'pagermode', mode) |
211 | 211 |
212 realmode = mode | 212 realmode = mode |
213 if pycompat.osname == 'nt': | 213 if pycompat.iswindows: |
214 from . import win32 | 214 from . import win32 |
215 | 215 |
216 term = encoding.environ.get('TERM') | 216 term = encoding.environ.get('TERM') |
217 # TERM won't be defined in a vanilla cmd.exe environment. | 217 # TERM won't be defined in a vanilla cmd.exe environment. |
218 | 218 |
377 msg = '\n'.join([_render_effects(ui, line, effects) | 377 msg = '\n'.join([_render_effects(ui, line, effects) |
378 for line in msg.split('\n')]) | 378 for line in msg.split('\n')]) |
379 return msg | 379 return msg |
380 | 380 |
381 w32effects = None | 381 w32effects = None |
382 if pycompat.osname == 'nt': | 382 if pycompat.iswindows: |
383 import ctypes | 383 import ctypes |
384 | 384 |
385 _kernel32 = ctypes.windll.kernel32 | 385 _kernel32 = ctypes.windll.kernel32 |
386 | 386 |
387 _WORD = ctypes.c_ushort | 387 _WORD = ctypes.c_ushort |