Mercurial > public > mercurial-scm > hg-stable
diff 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 |
line wrap: on
line diff
--- a/mercurial/util.py Thu Oct 12 19:20:04 2017 -0700 +++ b/mercurial/util.py Thu Oct 12 23:30:46 2017 -0700 @@ -92,7 +92,7 @@ if isatty(stdout): stdout = os.fdopen(stdout.fileno(), pycompat.sysstr('wb'), 1) -if pycompat.osname == 'nt': +if pycompat.iswindows: from . import windows as platform stdout = platform.winstdout(stdout) else: @@ -1348,7 +1348,7 @@ return _("filename ends with '%s', which is not allowed " "on Windows") % t -if pycompat.osname == 'nt': +if pycompat.iswindows: checkosfilename = checkwinfilename timer = time.clock else: @@ -1572,7 +1572,7 @@ # pure build; use a safe default return True else: - return pycompat.osname == "nt" or encoding.environ.get("DISPLAY") + return pycompat.iswindows or encoding.environ.get("DISPLAY") def mktempcopy(name, emptyok=False, createmode=None): """Create a temporary file with the same contents from name