##// END OF EJS Templates
py3: add b suffix to make sure file is opened in bytes mode...
Pulkit Goyal -
r40650:aa588bf4 default
parent child Browse files
Show More
@@ -373,8 +373,8 class mutablebasepack(versionmixin):
373 suffix=self.PACKSUFFIX + '-tmp')
373 suffix=self.PACKSUFFIX + '-tmp')
374 self.idxfp, self.idxpath = opener.mkstemp(
374 self.idxfp, self.idxpath = opener.mkstemp(
375 suffix=self.INDEXSUFFIX + '-tmp')
375 suffix=self.INDEXSUFFIX + '-tmp')
376 self.packfp = os.fdopen(self.packfp, r'w+')
376 self.packfp = os.fdopen(self.packfp, r'wb+')
377 self.idxfp = os.fdopen(self.idxfp, r'w+')
377 self.idxfp = os.fdopen(self.idxfp, r'wb+')
378 self.sha = hashlib.sha1()
378 self.sha = hashlib.sha1()
379 self._closed = False
379 self._closed = False
380
380
@@ -255,7 +255,7 class basestore(object):
255 they want to be kept alive in the store.
255 they want to be kept alive in the store.
256 """
256 """
257 repospath = os.path.join(self._path, "repos")
257 repospath = os.path.join(self._path, "repos")
258 with open(repospath, 'a') as reposfile:
258 with open(repospath, 'ab') as reposfile:
259 reposfile.write(os.path.dirname(path) + "\n")
259 reposfile.write(os.path.dirname(path) + "\n")
260
260
261 repospathstat = os.stat(repospath)
261 repospathstat = os.stat(repospath)
@@ -270,7 +270,7 class basestore(object):
270 return True
270 return True
271
271
272 if self._validatecachelog:
272 if self._validatecachelog:
273 with open(self._validatecachelog, 'a+') as f:
273 with open(self._validatecachelog, 'ab+') as f:
274 f.write("corrupt %s during %s\n" % (path, action))
274 f.write("corrupt %s during %s\n" % (path, action))
275
275
276 os.rename(path, path + ".corrupt")
276 os.rename(path, path + ".corrupt")
@@ -176,7 +176,7 def _decompressblob(raw):
176
176
177 def parsefileblob(path, decompress):
177 def parsefileblob(path, decompress):
178 raw = None
178 raw = None
179 f = open(path, "r")
179 f = open(path, "rb")
180 try:
180 try:
181 raw = f.read()
181 raw = f.read()
182 finally:
182 finally:
@@ -482,7 +482,7 class fileserverclient(object):
482
482
483 def close(self):
483 def close(self):
484 if fetches:
484 if fetches:
485 msg = ("%s files fetched over %d fetches - " +
485 msg = ("%d files fetched over %d fetches - " +
486 "(%d misses, %0.2f%% hit ratio) over %0.2fs\n") % (
486 "(%d misses, %0.2f%% hit ratio) over %0.2fs\n") % (
487 fetched,
487 fetched,
488 fetches,
488 fetches,
@@ -234,7 +234,7 def _loadfileblob(repo, cachepath, path,
234
234
235 f = None
235 f = None
236 try:
236 try:
237 f = util.atomictempfile(filecachepath, "w")
237 f = util.atomictempfile(filecachepath, "wb")
238 f.write(text)
238 f.write(text)
239 except (IOError, OSError):
239 except (IOError, OSError):
240 # Don't abort if the user only has permission to read,
240 # Don't abort if the user only has permission to read,
@@ -246,7 +246,7 def _loadfileblob(repo, cachepath, path,
246 finally:
246 finally:
247 os.umask(oldumask)
247 os.umask(oldumask)
248 else:
248 else:
249 with open(filecachepath, "r") as f:
249 with open(filecachepath, "rb") as f:
250 text = f.read()
250 text = f.read()
251 return text
251 return text
252
252
General Comments 0
You need to be logged in to leave comments. Login now