##// END OF EJS Templates
infinitepush: replace `NamedTemporaryFile` with `pycompat.namedtempfile`...
Connor Sheehan -
r45752:a52bf967 stable
parent child Browse files
Show More
@@ -20,8 +20,6 b' from mercurial.utils import ('
20 procutil,
20 procutil,
21 )
21 )
22
22
23 NamedTemporaryFile = tempfile.NamedTemporaryFile
24
25
23
26 class BundleWriteException(Exception):
24 class BundleWriteException(Exception):
27 pass
25 pass
@@ -142,7 +140,7 b' class externalbundlestore(abstractbundle'
142 # closing it
140 # closing it
143 # TODO: rewrite without str.format() and replace NamedTemporaryFile()
141 # TODO: rewrite without str.format() and replace NamedTemporaryFile()
144 # with pycompat.namedtempfile()
142 # with pycompat.namedtempfile()
145 with NamedTemporaryFile() as temp:
143 with pycompat.namedtempfile() as temp:
146 temp.write(data)
144 temp.write(data)
147 temp.flush()
145 temp.flush()
148 temp.seek(0)
146 temp.seek(0)
@@ -168,9 +166,8 b' class externalbundlestore(abstractbundle'
168 def read(self, handle):
166 def read(self, handle):
169 # Won't work on windows because you can't open file second time without
167 # Won't work on windows because you can't open file second time without
170 # closing it
168 # closing it
171 # TODO: rewrite without str.format() and replace NamedTemporaryFile()
169 # TODO: rewrite without str.format()
172 # with pycompat.namedtempfile()
170 with pycompat.namedtempfile() as temp:
173 with NamedTemporaryFile() as temp:
174 formatted_args = [
171 formatted_args = [
175 arg.format(filename=temp.name, handle=handle)
172 arg.format(filename=temp.name, handle=handle)
176 for arg in self.get_args
173 for arg in self.get_args
General Comments 0
You need to be logged in to leave comments. Login now