##// END OF EJS Templates
py3: use r'' instead of sysstr('') to get around code transformer...
Yuya Nishihara -
r36853:5bc7ff10 default
parent child Browse files
Show More
@@ -1310,7 +1310,7 b' class svn_sink(converter_sink, commandli'
1310 self.setexec = []
1310 self.setexec = []
1311
1311
1312 fd, messagefile = tempfile.mkstemp(prefix='hg-convert-')
1312 fd, messagefile = tempfile.mkstemp(prefix='hg-convert-')
1313 fp = os.fdopen(fd, pycompat.sysstr('wb'))
1313 fp = os.fdopen(fd, r'wb')
1314 fp.write(util.tonativeeol(commit.desc))
1314 fp.write(util.tonativeeol(commit.desc))
1315 fp.close()
1315 fp.close()
1316 try:
1316 try:
@@ -60,11 +60,11 b' class gpg(object):'
60 try:
60 try:
61 # create temporary files
61 # create temporary files
62 fd, sigfile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".sig")
62 fd, sigfile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".sig")
63 fp = os.fdopen(fd, pycompat.sysstr('wb'))
63 fp = os.fdopen(fd, r'wb')
64 fp.write(sig)
64 fp.write(sig)
65 fp.close()
65 fp.close()
66 fd, datafile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".txt")
66 fd, datafile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".txt")
67 fp = os.fdopen(fd, pycompat.sysstr('wb'))
67 fp = os.fdopen(fd, r'wb')
68 fp.write(data)
68 fp.write(data)
69 fp.close()
69 fp.close()
70 gpgcmd = ("%s --logger-fd 1 --status-fd 1 --verify "
70 gpgcmd = ("%s --logger-fd 1 --status-fd 1 --verify "
@@ -212,7 +212,7 b' class transplanter(object):'
212 patchfile = None
212 patchfile = None
213 else:
213 else:
214 fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-')
214 fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-')
215 fp = os.fdopen(fd, pycompat.sysstr('wb'))
215 fp = os.fdopen(fd, r'wb')
216 gen = patch.diff(source, parent, node, opts=diffopts)
216 gen = patch.diff(source, parent, node, opts=diffopts)
217 for chunk in gen:
217 for chunk in gen:
218 fp.write(chunk)
218 fp.write(chunk)
@@ -260,7 +260,7 b' class transplanter(object):'
260 self.ui.status(_('filtering %s\n') % patchfile)
260 self.ui.status(_('filtering %s\n') % patchfile)
261 user, date, msg = (changelog[1], changelog[2], changelog[4])
261 user, date, msg = (changelog[1], changelog[2], changelog[4])
262 fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-')
262 fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-')
263 fp = os.fdopen(fd, pycompat.sysstr('wb'))
263 fp = os.fdopen(fd, r'wb')
264 fp.write("# HG changeset patch\n")
264 fp.write("# HG changeset patch\n")
265 fp.write("# User %s\n" % user)
265 fp.write("# User %s\n" % user)
266 fp.write("# Date %d %d\n" % date)
266 fp.write("# Date %d %d\n" % date)
@@ -349,7 +349,7 b' class bundlerepository(localrepo.localre'
349 suffix=suffix)
349 suffix=suffix)
350 self.tempfile = temp
350 self.tempfile = temp
351
351
352 with os.fdopen(fdtemp, pycompat.sysstr('wb')) as fptemp:
352 with os.fdopen(fdtemp, r'wb') as fptemp:
353 fptemp.write(header)
353 fptemp.write(header)
354 while True:
354 while True:
355 chunk = readfn(2**18)
355 chunk = readfn(2**18)
@@ -75,7 +75,7 b' def writechunks(ui, chunks, filename, vf'
75 fh = open(filename, "wb", 131072)
75 fh = open(filename, "wb", 131072)
76 else:
76 else:
77 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
77 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
78 fh = os.fdopen(fd, pycompat.sysstr("wb"))
78 fh = os.fdopen(fd, r"wb")
79 cleanup = filename
79 cleanup = filename
80 for c in chunks:
80 for c in chunks:
81 fh.write(c)
81 fh.write(c)
@@ -296,9 +296,9 b' class channeledsystem(object):'
296
296
297 _iochannels = [
297 _iochannels = [
298 # server.ch, ui.fp, mode
298 # server.ch, ui.fp, mode
299 ('cin', 'fin', pycompat.sysstr('rb')),
299 ('cin', 'fin', r'rb'),
300 ('cout', 'fout', pycompat.sysstr('wb')),
300 ('cout', 'fout', r'wb'),
301 ('cerr', 'ferr', pycompat.sysstr('wb')),
301 ('cerr', 'ferr', r'wb'),
302 ]
302 ]
303
303
304 class chgcmdserver(commandserver.server):
304 class chgcmdserver(commandserver.server):
@@ -303,8 +303,8 b' def _protectio(ui):'
303 ui.flush()
303 ui.flush()
304 newfiles = []
304 newfiles = []
305 nullfd = os.open(os.devnull, os.O_RDWR)
305 nullfd = os.open(os.devnull, os.O_RDWR)
306 for f, sysf, mode in [(ui.fin, util.stdin, pycompat.sysstr('rb')),
306 for f, sysf, mode in [(ui.fin, util.stdin, r'rb'),
307 (ui.fout, util.stdout, pycompat.sysstr('wb'))]:
307 (ui.fout, util.stdout, r'wb')]:
308 if f is sysf:
308 if f is sysf:
309 newfd = os.dup(f.fileno())
309 newfd = os.dup(f.fileno())
310 os.dup2(nullfd, f.fileno())
310 os.dup2(nullfd, f.fileno())
@@ -1119,7 +1119,7 b' def debuginstall(ui, **opts):'
1119
1119
1120 def writetemp(contents):
1120 def writetemp(contents):
1121 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1121 (fd, name) = tempfile.mkstemp(prefix="hg-debuginstall-")
1122 f = os.fdopen(fd, pycompat.sysstr("wb"))
1122 f = os.fdopen(fd, r"wb")
1123 f.write(contents)
1123 f.write(contents)
1124 f.close()
1124 f.close()
1125 return name
1125 return name
@@ -674,7 +674,7 b' def _maketempfiles(repo, fco, fca):'
674 pre = "%s~%s." % (os.path.basename(fullbase), prefix)
674 pre = "%s~%s." % (os.path.basename(fullbase), prefix)
675 (fd, name) = tempfile.mkstemp(prefix=pre, suffix=ext)
675 (fd, name) = tempfile.mkstemp(prefix=pre, suffix=ext)
676 data = repo.wwritedata(ctx.path(), ctx.data())
676 data = repo.wwritedata(ctx.path(), ctx.data())
677 f = os.fdopen(fd, pycompat.sysstr("wb"))
677 f = os.fdopen(fd, r"wb")
678 f.write(data)
678 f.write(data)
679 f.close()
679 f.close()
680 return name
680 return name
@@ -459,7 +459,7 b' class httppeer(wireproto.wirepeer):'
459 try:
459 try:
460 # dump bundle to disk
460 # dump bundle to disk
461 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
461 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
462 fh = os.fdopen(fd, pycompat.sysstr("wb"))
462 fh = os.fdopen(fd, r"wb")
463 d = fp.read(4096)
463 d = fp.read(4096)
464 while d:
464 while d:
465 fh.write(d)
465 fh.write(d)
@@ -50,7 +50,7 b' if (pycompat.iswindows'
50
50
51 def setdatapath(datapath):
51 def setdatapath(datapath):
52 datapath = pycompat.fsdecode(datapath)
52 datapath = pycompat.fsdecode(datapath)
53 localedir = os.path.join(datapath, pycompat.sysstr('locale'))
53 localedir = os.path.join(datapath, r'locale')
54 t = gettextmod.translation(r'hg', localedir, _languages, fallback=True)
54 t = gettextmod.translation(r'hg', localedir, _languages, fallback=True)
55 global _ugettext
55 global _ugettext
56 try:
56 try:
@@ -216,7 +216,7 b' def extract(ui, fileobj):'
216
216
217 data = {}
217 data = {}
218 fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
218 fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
219 tmpfp = os.fdopen(fd, pycompat.sysstr('wb'))
219 tmpfp = os.fdopen(fd, r'wb')
220 try:
220 try:
221 msg = pycompat.emailparser().parse(fileobj)
221 msg = pycompat.emailparser().parse(fileobj)
222
222
@@ -1106,7 +1106,7 b' the hunk is left unchanged.'
1106 ncpatchfp = None
1106 ncpatchfp = None
1107 try:
1107 try:
1108 # Write the initial patch
1108 # Write the initial patch
1109 f = os.fdopen(patchfd, pycompat.sysstr("w"))
1109 f = os.fdopen(patchfd, r"w")
1110 chunk.header.write(f)
1110 chunk.header.write(f)
1111 chunk.write(f)
1111 chunk.write(f)
1112 f.write('\n'.join(['# ' + i for i in phelp.splitlines()]))
1112 f.write('\n'.join(['# ' + i for i in phelp.splitlines()]))
@@ -18,7 +18,7 b' class _pycompatstub(object):'
18 """Add items that will be populated at the first access"""
18 """Add items that will be populated at the first access"""
19 items = map(_sysstr, items)
19 items = map(_sysstr, items)
20 self._aliases.update(
20 self._aliases.update(
21 (item.replace(_sysstr('_'), _sysstr('')).lower(), (origin, item))
21 (item.replace(r'_', r'').lower(), (origin, item))
22 for item in items)
22 for item in items)
23
23
24 def _registeralias(self, origin, attr, name):
24 def _registeralias(self, origin, attr, name):
@@ -91,7 +91,7 b' def isatty(fp):'
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
@@ -1251,7 +1251,7 b' def tempfilter(s, cmd):'
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-')
@@ -1413,7 +1413,7 b' def hgexecutable():'
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():
@@ -1027,7 +1027,7 b' def unbundle(repo, proto, heads):'
1027
1027
1028 # write bundle data to temporary file because it can be big
1028 # write bundle data to temporary file because it can be big
1029 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
1029 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
1030 fp = os.fdopen(fd, pycompat.sysstr('wb+'))
1030 fp = os.fdopen(fd, r'wb+')
1031 r = 0
1031 r = 0
1032 try:
1032 try:
1033 proto.forwardpayload(fp)
1033 proto.forwardpayload(fp)
@@ -176,7 +176,7 b' def _posixworker(ui, func, staticargs, a'
176 os._exit(ret & 255)
176 os._exit(ret & 255)
177 pids.add(pid)
177 pids.add(pid)
178 os.close(wfd)
178 os.close(wfd)
179 fp = os.fdopen(rfd, pycompat.sysstr('rb'), 0)
179 fp = os.fdopen(rfd, r'rb', 0)
180 def cleanup():
180 def cleanup():
181 signal.signal(signal.SIGINT, oldhandler)
181 signal.signal(signal.SIGINT, oldhandler)
182 waitforworkers()
182 waitforworkers()
General Comments 0
You need to be logged in to leave comments. Login now