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