Mercurial > hg
comparison mercurial/util.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 | 6f11a74d489f |
children | 238abf65a8ad |
comparison
equal
deleted
inserted
replaced
34644:c0a6c19690ff | 34645:75979c8d4572 |
---|---|
90 # destined stdout with a pipe destined stdout (e.g. pager), we want line | 90 # destined stdout with a pipe destined stdout (e.g. pager), we want line |
91 # buffering | 91 # buffering |
92 if isatty(stdout): | 92 if isatty(stdout): |
93 stdout = os.fdopen(stdout.fileno(), pycompat.sysstr('wb'), 1) | 93 stdout = os.fdopen(stdout.fileno(), pycompat.sysstr('wb'), 1) |
94 | 94 |
95 if pycompat.osname == 'nt': | 95 if pycompat.iswindows: |
96 from . import windows as platform | 96 from . import windows as platform |
97 stdout = platform.winstdout(stdout) | 97 stdout = platform.winstdout(stdout) |
98 else: | 98 else: |
99 from . import posix as platform | 99 from . import posix as platform |
100 | 100 |
1346 t = n[-1:] | 1346 t = n[-1:] |
1347 if t in '. ' and n not in '..': | 1347 if t in '. ' and n not in '..': |
1348 return _("filename ends with '%s', which is not allowed " | 1348 return _("filename ends with '%s', which is not allowed " |
1349 "on Windows") % t | 1349 "on Windows") % t |
1350 | 1350 |
1351 if pycompat.osname == 'nt': | 1351 if pycompat.iswindows: |
1352 checkosfilename = checkwinfilename | 1352 checkosfilename = checkwinfilename |
1353 timer = time.clock | 1353 timer = time.clock |
1354 else: | 1354 else: |
1355 checkosfilename = platform.checkosfilename | 1355 checkosfilename = platform.checkosfilename |
1356 timer = time.time | 1356 timer = time.time |
1570 return osutil.isgui() | 1570 return osutil.isgui() |
1571 else: | 1571 else: |
1572 # pure build; use a safe default | 1572 # pure build; use a safe default |
1573 return True | 1573 return True |
1574 else: | 1574 else: |
1575 return pycompat.osname == "nt" or encoding.environ.get("DISPLAY") | 1575 return pycompat.iswindows or encoding.environ.get("DISPLAY") |
1576 | 1576 |
1577 def mktempcopy(name, emptyok=False, createmode=None): | 1577 def mktempcopy(name, emptyok=False, createmode=None): |
1578 """Create a temporary file with the same contents from name | 1578 """Create a temporary file with the same contents from name |
1579 | 1579 |
1580 The permission bits are copied from the original file. | 1580 The permission bits are copied from the original file. |