##// END OF EJS Templates
py3: convert the mode argument of os.fdopen to unicodes (2 of 2)
Pulkit Goyal -
r30925:82f1ef8b default
parent child Browse files
Show More
@@ -1306,7 +1306,7 b' class svn_sink(converter_sink, commandli'
1306 self.setexec = []
1306 self.setexec = []
1307
1307
1308 fd, messagefile = tempfile.mkstemp(prefix='hg-convert-')
1308 fd, messagefile = tempfile.mkstemp(prefix='hg-convert-')
1309 fp = os.fdopen(fd, 'w')
1309 fp = os.fdopen(fd, pycompat.sysstr('w'))
1310 fp.write(commit.desc)
1310 fp.write(commit.desc)
1311 fp.close()
1311 fp.close()
1312 try:
1312 try:
@@ -18,6 +18,7 b' from mercurial import ('
18 error,
18 error,
19 match,
19 match,
20 node as hgnode,
20 node as hgnode,
21 pycompat,
21 util,
22 util,
22 )
23 )
23
24
@@ -44,11 +45,11 b' class gpg(object):'
44 try:
45 try:
45 # create temporary files
46 # create temporary files
46 fd, sigfile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".sig")
47 fd, sigfile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".sig")
47 fp = os.fdopen(fd, 'wb')
48 fp = os.fdopen(fd, pycompat.sysstr('wb'))
48 fp.write(sig)
49 fp.write(sig)
49 fp.close()
50 fp.close()
50 fd, datafile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".txt")
51 fd, datafile = tempfile.mkstemp(prefix="hg-gpg-", suffix=".txt")
51 fp = os.fdopen(fd, 'wb')
52 fp = os.fdopen(fd, pycompat.sysstr('wb'))
52 fp.write(data)
53 fp.write(data)
53 fp.close()
54 fp.close()
54 gpgcmd = ("%s --logger-fd 1 --status-fd 1 --verify "
55 gpgcmd = ("%s --logger-fd 1 --status-fd 1 --verify "
@@ -28,6 +28,7 b' from mercurial import ('
28 merge,
28 merge,
29 node as nodemod,
29 node as nodemod,
30 patch,
30 patch,
31 pycompat,
31 registrar,
32 registrar,
32 revlog,
33 revlog,
33 revset,
34 revset,
@@ -197,7 +198,7 b' class transplanter(object):'
197 patchfile = None
198 patchfile = None
198 else:
199 else:
199 fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-')
200 fd, patchfile = tempfile.mkstemp(prefix='hg-transplant-')
200 fp = os.fdopen(fd, 'w')
201 fp = os.fdopen(fd, pycompat.sysstr('w'))
201 gen = patch.diff(source, parent, node, opts=diffopts)
202 gen = patch.diff(source, parent, node, opts=diffopts)
202 for chunk in gen:
203 for chunk in gen:
203 fp.write(chunk)
204 fp.write(chunk)
@@ -245,7 +246,7 b' class transplanter(object):'
245 self.ui.status(_('filtering %s\n') % patchfile)
246 self.ui.status(_('filtering %s\n') % patchfile)
246 user, date, msg = (changelog[1], changelog[2], changelog[4])
247 user, date, msg = (changelog[1], changelog[2], changelog[4])
247 fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-')
248 fd, headerfile = tempfile.mkstemp(prefix='hg-transplant-')
248 fp = os.fdopen(fd, 'w')
249 fp = os.fdopen(fd, pycompat.sysstr('w'))
249 fp.write("# HG changeset patch\n")
250 fp.write("# HG changeset patch\n")
250 fp.write("# User %s\n" % user)
251 fp.write("# User %s\n" % user)
251 fp.write("# Date %d %d\n" % date)
252 fp.write("# Date %d %d\n" % date)
@@ -26,6 +26,7 b' from . import ('
26 error,
26 error,
27 mdiff,
27 mdiff,
28 phases,
28 phases,
29 pycompat,
29 util,
30 util,
30 )
31 )
31
32
@@ -98,7 +99,7 b' def writechunks(ui, chunks, filename, vf'
98 fh = open(filename, "wb", 131072)
99 fh = open(filename, "wb", 131072)
99 else:
100 else:
100 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
101 fd, filename = tempfile.mkstemp(prefix="hg-bundle-", suffix=".hg")
101 fh = os.fdopen(fd, "wb")
102 fh = os.fdopen(fd, pycompat.sysstr("wb"))
102 cleanup = filename
103 cleanup = filename
103 for c in chunks:
104 for c in chunks:
104 fh.write(c)
105 fh.write(c)
@@ -338,7 +338,7 b' else:'
338 _kernel32.CloseHandle(fh)
338 _kernel32.CloseHandle(fh)
339 _raiseioerror(name)
339 _raiseioerror(name)
340
340
341 f = os.fdopen(fd, mode, bufsize)
341 f = os.fdopen(fd, pycompat.sysstr(mode), bufsize)
342 # unfortunately, f.name is '<fdopen>' at this point -- so we store
342 # unfortunately, f.name is '<fdopen>' at this point -- so we store
343 # the name on this wrapper. We cannot just assign to f.name,
343 # the name on this wrapper. We cannot just assign to f.name,
344 # because that attribute is read-only.
344 # because that attribute is read-only.
@@ -1038,7 +1038,7 b' class ui(object):'
1038 suffix=extra['suffix'], text=True,
1038 suffix=extra['suffix'], text=True,
1039 dir=rdir)
1039 dir=rdir)
1040 try:
1040 try:
1041 f = os.fdopen(fd, "w")
1041 f = os.fdopen(fd, pycompat.sysstr("w"))
1042 f.write(text)
1042 f.write(text)
1043 f.close()
1043 f.close()
1044
1044
@@ -809,7 +809,7 b' def tempfilter(s, cmd):'
809 inname, outname = None, None
809 inname, outname = None, None
810 try:
810 try:
811 infd, inname = tempfile.mkstemp(prefix='hg-filter-in-')
811 infd, inname = tempfile.mkstemp(prefix='hg-filter-in-')
812 fp = os.fdopen(infd, 'wb')
812 fp = os.fdopen(infd, pycompat.sysstr('wb'))
813 fp.write(s)
813 fp.write(s)
814 fp.close()
814 fp.close()
815 outfd, outname = tempfile.mkstemp(prefix='hg-filter-out-')
815 outfd, outname = tempfile.mkstemp(prefix='hg-filter-out-')
General Comments 0
You need to be logged in to leave comments. Login now