@@ -543,7 +543,7 @@
# Only Windows/NTFS has slow file closing. So only enable by default
# on that platform. But allow to be enabled elsewhere for testing.
- defaultenabled = pycompat.osname == 'nt'
+ defaultenabled = pycompat.iswindows
enabled = ui.configbool('worker', 'backgroundclose', defaultenabled)
if not enabled:
@@ -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:
@@ -1041,7 +1041,7 @@
# gracefully and tell the user about their broken pager.
shell = any(c in command for c in "|&;<>()$`\\\"' \t\n*?[#~=%")
- if pycompat.osname == 'nt' and not shell:
+ if pycompat.iswindows and not shell:
# Window's built-in `more` cannot be invoked with shell=False, but
# its `more.com` can. Hide this implementation detail from the
# user so we can also get sane bad PAGER behavior. MSYS has
@@ -1347,7 +1347,7 @@
if e.errno != errno.ENOENT:
raise error.Abort(genericerror % (
self._path, encoding.strtolocal(e.strerror)))
- elif pycompat.osname == 'nt':
+ elif pycompat.iswindows:
try:
self._gitexecutable = 'git.cmd'
out, err = self._gitnodir(['--version'])
@@ -477,7 +477,7 @@
'for more info)\n'))
elif (e.reason == 'CERTIFICATE_VERIFY_FAILED' and
- pycompat.osname == 'nt'):
+ pycompat.iswindows):
ui.warn(_('(the full certificate chain may not be available '
'locally; see "hg help debugssl")\n'))
@@ -717,7 +717,7 @@
# because we'll get a certificate verification error later and the lack
# of loaded CA certificates will be the reason why.
# Assertion: this code is only called if certificates are being verified.
- if pycompat.osname == 'nt':
+ if pycompat.iswindows:
if not _canloaddefaultcerts:
ui.warn(_('(unable to load Windows CA certificates; see '
'https://mercurial-scm.org/wiki/SecureConnections for '
@@ -41,7 +41,7 @@
vfs,
)
-if pycompat.osname == 'nt':
+if pycompat.iswindows:
from . import scmwindows as scmplatform
else:
from . import scmposix as scmplatform
@@ -291,7 +291,7 @@
val = ui.config('ui', 'portablefilenames')
lval = val.lower()
bval = util.parsebool(val)
- abort = pycompat.osname == 'nt' or lval == 'abort'
+ abort = pycompat.iswindows or lval == 'abort'
warn = bval or lval == 'warn'
if bval is None and not (warn or abort or lval == 'ignore'):
raise error.ConfigError(
@@ -15,7 +15,7 @@
util,
)
-if pycompat.osname == 'nt':
+if pycompat.iswindows:
from . import scmwindows as scmplatform
else:
from . import scmposix as scmplatform
@@ -29,7 +29,7 @@
unicode = str
_languages = None
-if (pycompat.osname == 'nt'
+if (pycompat.iswindows
and 'LANGUAGE' not in encoding.environ
and 'LC_ALL' not in encoding.environ
and 'LC_MESSAGES' not in encoding.environ
@@ -266,7 +266,7 @@
class MercurialHTTPServer(_mixin, httpservermod.httpserver, object):
# SO_REUSEADDR has broken semantics on windows
- if pycompat.osname == 'nt':
+ if pycompat.iswindows:
allow_reuse_address = 0
def __init__(self, ui, app, addr, handler, **kwargs):
@@ -210,7 +210,7 @@
mode = ui.config('color', 'pagermode', mode)
realmode = mode
- if pycompat.osname == 'nt':
+ if pycompat.iswindows:
from . import win32
term = encoding.environ.get('TERM')
@@ -379,7 +379,7 @@
return msg
w32effects = None
-if pycompat.osname == 'nt':
+if pycompat.iswindows:
import ctypes
_kernel32 = ctypes.windll.kernel32
@@ -190,7 +190,7 @@
if _encoding.lower() in problematic_encodings.split():
for f in funcs.split():
wrapname(f, wrapper)
- if pycompat.osname == 'nt':
+ if pycompat.iswindows:
for f in winfuncs.split():
wrapname(f, wrapper)
wrapname("mercurial.util.listdir", wrapperforlistdir)
@@ -116,7 +116,7 @@
schemes.update(dict(ui.configitems('schemes')))
t = templater.engine(lambda x: x)
for scheme, url in schemes.items():
- if (pycompat.osname == 'nt' and len(scheme) == 1 and scheme.isalpha()
+ if (pycompat.iswindows and len(scheme) == 1 and scheme.isalpha()
and os.path.exists('%s:\\' % scheme)):
raise error.Abort(_('custom scheme %s:// conflicts with drive '
'letter %s:\\\n') % (scheme, scheme.upper()))
@@ -52,7 +52,7 @@
testedwith = 'ships-with-hg-core'
def uisetup(ui):
- if pycompat.osname == 'nt':
+ if pycompat.iswindows:
# no fork on Windows, but we can create a detached process
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863.aspx
# No stdlib constant exists for this value
@@ -75,7 +75,7 @@
path = ui.configpath(longname, 'usercache', None)
if path:
return path
- if pycompat.osname == 'nt':
+ if pycompat.iswindows:
appdata = encoding.environ.get('LOCALAPPDATA',\
encoding.environ.get('APPDATA'))
if appdata:
@@ -103,7 +103,7 @@
pass
if os.path.isdir(path):
path = os.path.normpath(os.path.abspath(path))
- if pycompat.osname == 'nt':
+ if pycompat.iswindows:
path = '/' + util.normpath(path)
# Module URL is later compared with the repository URL returned
# by svn API, which is UTF-8.
@@ -254,7 +254,7 @@
try:
proto, path = url.split('://', 1)
if proto == 'file':
- if (pycompat.osname == 'nt' and path[:1] == '/'
+ if (pycompat.iswindows and path[:1] == '/'
and path[1:2].isalpha() and path[2:6].lower() == '%3a/'):
path = path[:2] + ':/' + path[6:]
path = urlreq.url2pathname(path)