comparison mercurial/scmutil.py @ 30639:d524c88511a7

py3: replace os.name with pycompat.osname (part 1 of 2) os.name returns unicodes on py3 and we have pycompat.osname which returns bytes. This series of 2 patches will change every ocurrence of os.name with pycompat.osname.
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 19 Dec 2016 00:16:52 +0530
parents 4338f87dbf6f
children 0b8356705de6
comparison
equal deleted inserted replaced
30638:1c5cbf28f007 30639:d524c88511a7
32 revset, 32 revset,
33 similar, 33 similar,
34 util, 34 util,
35 ) 35 )
36 36
37 if os.name == 'nt': 37 if pycompat.osname == 'nt':
38 from . import scmwindows as scmplatform 38 from . import scmwindows as scmplatform
39 else: 39 else:
40 from . import scmposix as scmplatform 40 from . import scmposix as scmplatform
41 41
42 systemrcpath = scmplatform.systemrcpath 42 systemrcpath = scmplatform.systemrcpath
279 '''check if the user's config requests nothing, a warning, or abort for 279 '''check if the user's config requests nothing, a warning, or abort for
280 non-portable filenames''' 280 non-portable filenames'''
281 val = ui.config('ui', 'portablefilenames', 'warn') 281 val = ui.config('ui', 'portablefilenames', 'warn')
282 lval = val.lower() 282 lval = val.lower()
283 bval = util.parsebool(val) 283 bval = util.parsebool(val)
284 abort = os.name == 'nt' or lval == 'abort' 284 abort = pycompat.osname == 'nt' or lval == 'abort'
285 warn = bval or lval == 'warn' 285 warn = bval or lval == 'warn'
286 if bval is None and not (warn or abort or lval == 'ignore'): 286 if bval is None and not (warn or abort or lval == 'ignore'):
287 raise error.ConfigError( 287 raise error.ConfigError(
288 _("ui.portablefilenames value is invalid ('%s')") % val) 288 _("ui.portablefilenames value is invalid ('%s')") % val)
289 return abort, warn 289 return abort, warn
1459 self._threads = [] 1459 self._threads = []
1460 self._threadexception = None 1460 self._threadexception = None
1461 1461
1462 # Only Windows/NTFS has slow file closing. So only enable by default 1462 # Only Windows/NTFS has slow file closing. So only enable by default
1463 # on that platform. But allow to be enabled elsewhere for testing. 1463 # on that platform. But allow to be enabled elsewhere for testing.
1464 defaultenabled = os.name == 'nt' 1464 defaultenabled = pycompat.osname == 'nt'
1465 enabled = ui.configbool('worker', 'backgroundclose', defaultenabled) 1465 enabled = ui.configbool('worker', 'backgroundclose', defaultenabled)
1466 1466
1467 if not enabled: 1467 if not enabled:
1468 return 1468 return
1469 1469