comparison mercurial/util.py @ 36835:5bc7ff103081

py3: use r'' instead of sysstr('') to get around code transformer Fewer function calls should be better.
author Yuya Nishihara <yuya@tcha.org>
date Sat, 10 Mar 2018 15:57:16 +0900
parents 6bdea0efdab5
children 472c68cda3f8
comparison
equal deleted inserted replaced
36834:1527f40de3b3 36835:5bc7ff103081
89 89
90 # glibc determines buffering on first write to stdout - if we replace a TTY 90 # glibc determines buffering on first write to stdout - if we replace a TTY
91 # destined stdout with a pipe destined stdout (e.g. pager), we want line 91 # destined stdout with a pipe destined stdout (e.g. pager), we want line
92 # buffering 92 # buffering
93 if isatty(stdout): 93 if isatty(stdout):
94 stdout = os.fdopen(stdout.fileno(), pycompat.sysstr('wb'), 1) 94 stdout = os.fdopen(stdout.fileno(), r'wb', 1)
95 95
96 if pycompat.iswindows: 96 if pycompat.iswindows:
97 from . import windows as platform 97 from . import windows as platform
98 stdout = platform.winstdout(stdout) 98 stdout = platform.winstdout(stdout)
99 else: 99 else:
1249 with the strings INFILE and OUTFILE replaced by the real names of 1249 with the strings INFILE and OUTFILE replaced by the real names of
1250 the temporary files generated.''' 1250 the temporary files generated.'''
1251 inname, outname = None, None 1251 inname, outname = None, None
1252 try: 1252 try:
1253 infd, inname = tempfile.mkstemp(prefix='hg-filter-in-') 1253 infd, inname = tempfile.mkstemp(prefix='hg-filter-in-')
1254 fp = os.fdopen(infd, pycompat.sysstr('wb')) 1254 fp = os.fdopen(infd, r'wb')
1255 fp.write(s) 1255 fp.write(s)
1256 fp.close() 1256 fp.close()
1257 outfd, outname = tempfile.mkstemp(prefix='hg-filter-out-') 1257 outfd, outname = tempfile.mkstemp(prefix='hg-filter-out-')
1258 os.close(outfd) 1258 os.close(outfd)
1259 cmd = cmd.replace('INFILE', inname) 1259 cmd = cmd.replace('INFILE', inname)
1411 1411
1412 Defaults to $HG or 'hg' in the search path. 1412 Defaults to $HG or 'hg' in the search path.
1413 """ 1413 """
1414 if _hgexecutable is None: 1414 if _hgexecutable is None:
1415 hg = encoding.environ.get('HG') 1415 hg = encoding.environ.get('HG')
1416 mainmod = sys.modules[pycompat.sysstr('__main__')] 1416 mainmod = sys.modules[r'__main__']
1417 if hg: 1417 if hg:
1418 _sethgexecutable(hg) 1418 _sethgexecutable(hg)
1419 elif mainfrozen(): 1419 elif mainfrozen():
1420 if getattr(sys, 'frozen', None) == 'macosx_app': 1420 if getattr(sys, 'frozen', None) == 'macosx_app':
1421 # Env variable set by py2app 1421 # Env variable set by py2app