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