##// END OF EJS Templates
py3: convert the mode argument of os.fdopen to unicodes (1 of 2)...
Pulkit Goyal -
r30924:48dea083 default
parent child Browse files
Show More
@@ -272,7 +272,7 b' class bundlerepository(localrepo.localre'
272 suffix=".hg10un")
272 suffix=".hg10un")
273 self.tempfile = temp
273 self.tempfile = temp
274
274
275 with os.fdopen(fdtemp, 'wb') as fptemp:
275 with os.fdopen(fdtemp, pycompat.sysstr('wb')) as fptemp:
276 fptemp.write(header)
276 fptemp.write(header)
277 while True:
277 while True:
278 chunk = read(2**18)
278 chunk = read(2**18)
@@ -287,9 +287,9 b' class channeledsystem(object):'
287
287
288 _iochannels = [
288 _iochannels = [
289 # server.ch, ui.fp, mode
289 # server.ch, ui.fp, mode
290 ('cin', 'fin', 'rb'),
290 ('cin', 'fin', pycompat.sysstr('rb')),
291 ('cout', 'fout', 'wb'),
291 ('cout', 'fout', pycompat.sysstr('wb')),
292 ('cerr', 'ferr', 'wb'),
292 ('cerr', 'ferr', pycompat.sysstr('wb')),
293 ]
293 ]
294
294
295 class chgcmdserver(commandserver.server):
295 class chgcmdserver(commandserver.server):
@@ -304,8 +304,8 b' def _protectio(ui):'
304 ui.flush()
304 ui.flush()
305 newfiles = []
305 newfiles = []
306 nullfd = os.open(os.devnull, os.O_RDWR)
306 nullfd = os.open(os.devnull, os.O_RDWR)
307 for f, sysf, mode in [(ui.fin, util.stdin, 'rb'),
307 for f, sysf, mode in [(ui.fin, util.stdin, pycompat.sysstr('rb')),
308 (ui.fout, util.stdout, 'wb')]:
308 (ui.fout, util.stdout, pycompat.sysstr('wb'))]:
309 if f is sysf:
309 if f is sysf:
310 newfd = os.dup(f.fileno())
310 newfd = os.dup(f.fileno())
311 os.dup2(nullfd, f.fileno())
311 os.dup2(nullfd, f.fileno())
@@ -585,7 +585,7 b' def _filemerge(premerge, repo, mynode, o'
585 pre = "%s~%s." % (os.path.basename(fullbase), prefix)
585 pre = "%s~%s." % (os.path.basename(fullbase), prefix)
586 (fd, name) = tempfile.mkstemp(prefix=pre, suffix=ext)
586 (fd, name) = tempfile.mkstemp(prefix=pre, suffix=ext)
587 data = repo.wwritedata(ctx.path(), ctx.data())
587 data = repo.wwritedata(ctx.path(), ctx.data())
588 f = os.fdopen(fd, "wb")
588 f = os.fdopen(fd, pycompat.sysstr("wb"))
589 f.write(data)
589 f.write(data)
590 f.close()
590 f.close()
591 return name
591 return name
@@ -20,6 +20,7 b' from . import ('
20 bundle2,
20 bundle2,
21 error,
21 error,
22 httpconnection,
22 httpconnection,
23 pycompat,
23 statichttprepo,
24 statichttprepo,
24 url,
25 url,
25 util,
26 util,
@@ -327,7 +328,7 b' class httppeer(wireproto.wirepeer):'
327 try:
328 try:
328 # dump bundle to disk
329 # dump bundle to disk
329 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
330 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
330 fh = os.fdopen(fd, "wb")
331 fh = os.fdopen(fd, pycompat.sysstr("wb"))
331 d = fp.read(4096)
332 d = fp.read(4096)
332 while d:
333 while d:
333 fh.write(d)
334 fh.write(d)
@@ -34,6 +34,7 b' from . import ('
34 mail,
34 mail,
35 mdiff,
35 mdiff,
36 pathutil,
36 pathutil,
37 pycompat,
37 scmutil,
38 scmutil,
38 similar,
39 similar,
39 util,
40 util,
@@ -209,7 +210,7 b' def extract(ui, fileobj):'
209
210
210 data = {}
211 data = {}
211 fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
212 fd, tmpname = tempfile.mkstemp(prefix='hg-patch-')
212 tmpfp = os.fdopen(fd, 'w')
213 tmpfp = os.fdopen(fd, pycompat.sysstr('w'))
213 try:
214 try:
214 msg = email.Parser.Parser().parse(fileobj)
215 msg = email.Parser.Parser().parse(fileobj)
215
216
@@ -1055,7 +1056,7 b' the hunk is left unchanged.'
1055 ncpatchfp = None
1056 ncpatchfp = None
1056 try:
1057 try:
1057 # Write the initial patch
1058 # Write the initial patch
1058 f = os.fdopen(patchfd, "w")
1059 f = os.fdopen(patchfd, pycompat.sysstr("w"))
1059 chunk.header.write(f)
1060 chunk.header.write(f)
1060 chunk.write(f)
1061 chunk.write(f)
1061 f.write('\n'.join(['# ' + i for i in phelp.splitlines()]))
1062 f.write('\n'.join(['# ' + i for i in phelp.splitlines()]))
@@ -26,6 +26,7 b' from . import ('
26 exchange,
26 exchange,
27 peer,
27 peer,
28 pushkey as pushkeymod,
28 pushkey as pushkeymod,
29 pycompat,
29 streamclone,
30 streamclone,
30 util,
31 util,
31 )
32 )
@@ -961,7 +962,7 b' def unbundle(repo, proto, heads):'
961
962
962 # write bundle data to temporary file because it can be big
963 # write bundle data to temporary file because it can be big
963 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
964 fd, tempname = tempfile.mkstemp(prefix='hg-unbundle-')
964 fp = os.fdopen(fd, 'wb+')
965 fp = os.fdopen(fd, pycompat.sysstr('wb+'))
965 r = 0
966 r = 0
966 try:
967 try:
967 proto.getfile(fp)
968 proto.getfile(fp)
@@ -157,7 +157,7 b' def _posixworker(ui, func, staticargs, a'
157 os._exit(0)
157 os._exit(0)
158 pids.add(pid)
158 pids.add(pid)
159 os.close(wfd)
159 os.close(wfd)
160 fp = os.fdopen(rfd, 'rb', 0)
160 fp = os.fdopen(rfd, pycompat.sysstr('rb'), 0)
161 def cleanup():
161 def cleanup():
162 signal.signal(signal.SIGINT, oldhandler)
162 signal.signal(signal.SIGINT, oldhandler)
163 waitforworkers()
163 waitforworkers()
General Comments 0
You need to be logged in to leave comments. Login now