##// 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:
339 if st:
340 data = fp.read(65536)
341 else:
342 # hack for httprangereader, it doesn't do partial reads well
343 data = fp.read()
338 data = fp.read()
344 if not data:
339 l = len(data)
345 break
340 if inline:
346 if n == 0 and inline:
347 # cache the first chunk
348 self.chunkcache = (0, data)
341 self.chunkcache = (0, data)
349 if leftover:
342 while off + s <= l:
350 data = leftover + data
343 e = struct.unpack(indexformatng, data[off:off + s])
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
358 cur = data[off:off + s]
359 off += s
360 e = struct.unpack(indexformatng, cur)
361 index.append(e)
344 index.append(e)
362 nodemap[e[-1]] = n
345 nodemap[e[-1]] = n
363 n += 1
346 n += 1
347 off += s
364 if inline:
348 if inline:
365 if e[1] < 0:
349 if e[1] < 0:
366 break
350 break
367 off += e[1]
351 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