##// END OF EJS Templates
revlog: simplify the v0 parser
Matt Mackall -
r4973:a386a6e4 default
parent child Browse files
Show More
@@ -300,33 +300,16 b' class revlogoldio(object):'
300 s = struct.calcsize(indexformatv0)
300 s = struct.calcsize(indexformatv0)
301 index = []
301 index = []
302 nodemap = {nullid: nullrev}
302 nodemap = {nullid: nullrev}
303 n = 0
303 n = off = 0
304 leftover = None
304 data = fp.read()
305 while True:
305 l = len(data)
306 if st:
306 while off + s <= l:
307 data = fp.read(65536)
307 cur = data[off:off + s]
308 else:
308 off += s
309 # hack for httprangereader, it doesn't do partial reads well
309 e = struct.unpack(indexformatv0, cur)
310 data = fp.read()
310 index.append(e)
311 if not data:
311 nodemap[e[-1]] = n
312 break
312 n += 1
313 if leftover:
314 data = leftover + data
315 leftover = None
316 off = 0
317 l = len(data)
318 while off < l:
319 if l - off < s:
320 leftover = data[off:]
321 break
322 cur = data[off:off + s]
323 off += s
324 e = struct.unpack(indexformatv0, cur)
325 index.append(e)
326 nodemap[e[-1]] = n
327 n += 1
328 if not st:
329 break
330
313
331 return index, nodemap
314 return index, nodemap
332
315
General Comments 0
You need to be logged in to leave comments. Login now