##// END OF EJS Templates
revlog: fix reading of larger revlog indices on Windows
Matt Mackall -
r8558:5726bb29 default
parent child Browse files
Show More
@@ -322,7 +322,7 b' class revlogoldio(object):'
322 322 index = []
323 323 nodemap = {nullid: nullrev}
324 324 n = off = 0
325 if len(data) < _prereadsize:
325 if len(data) == _prereadsize:
326 326 data += fp.read() # read the rest
327 327 l = len(data)
328 328 while off + s <= l:
@@ -362,23 +362,19 b' class revlogio(object):'
362 362 self.size = struct.calcsize(indexformatng)
363 363
364 364 def parseindex(self, fp, data, inline):
365 try:
366 size = len(data)
367 if size == _prereadsize:
368 size = util.fstat(fp).st_size
369 except AttributeError:
370 size = 0
371
372 if util.openhardlinks() and not inline and size > _prereadsize:
373 # big index, let's parse it on demand
374 parser = lazyparser(fp, size)
375 index = lazyindex(parser)
376 nodemap = lazymap(parser)
377 e = list(index[0])
378 type = gettype(e[0])
379 e[0] = offset_type(0, type)
380 index[0] = e
381 return index, nodemap, None
365 if len(data) == _prereadsize:
366 if util.openhardlinks() and not inline:
367 # big index, let's parse it on demand
368 parser = lazyparser(fp, size)
369 index = lazyindex(parser)
370 nodemap = lazymap(parser)
371 e = list(index[0])
372 type = gettype(e[0])
373 e[0] = offset_type(0, type)
374 index[0] = e
375 return index, nodemap, None
376 else:
377 data += fp.read()
382 378
383 379 # call the C implementation to parse the index data
384 380 index, nodemap, cache = parsers.parse_index(data, inline)
General Comments 0
You need to be logged in to leave comments. Login now