##// END OF EJS Templates
revlog: simplify the v1 immediate parser...
Matt Mackall -
r4975:8b7e480a default
parent child Browse files
Show More
@@ -333,44 +333,22 b' class revlogio(object):'
333 s = struct.calcsize(indexformatng)
333 s = struct.calcsize(indexformatng)
334 index = []
334 index = []
335 nodemap = {nullid: nullrev}
335 nodemap = {nullid: nullrev}
336 n = 0
336 n = off = 0
337 leftover = None
337 # if we're not using lazymap, always read the whole index
338 while True:
338 data = fp.read()
339 if st:
339 l = len(data)
340 data = fp.read(65536)
340 if inline:
341 else:
341 self.chunkcache = (0, data)
342 # hack for httprangereader, it doesn't do partial reads well
342 while off + s <= l:
343 data = fp.read()
343 e = struct.unpack(indexformatng, data[off:off + s])
344 if not data:
344 index.append(e)
345 break
345 nodemap[e[-1]] = n
346 if n == 0 and inline:
346 n += 1
347 # cache the first chunk
347 off += s
348 self.chunkcache = (0, data)
348 if inline:
349 if leftover:
349 if e[1] < 0:
350 data = leftover + data
351 leftover = None
352 off = 0
353 l = len(data)
354 while off < l:
355 if l - off < s:
356 leftover = data[off:]
357 break
350 break
358 cur = data[off:off + s]
351 off += e[1]
359 off += s
360 e = struct.unpack(indexformatng, cur)
361 index.append(e)
362 nodemap[e[-1]] = n
363 n += 1
364 if inline:
365 if e[1] < 0:
366 break
367 off += e[1]
368 if off > l:
369 # some things don't seek well, just read it
370 fp.read(off - l)
371 break
372 if not st:
373 break
374
352
375 e = list(index[0])
353 e = list(index[0])
376 type = gettype(e[0])
354 type = gettype(e[0])
General Comments 0
You need to be logged in to leave comments. Login now