Show More
@@ -12,7 +12,7 b' of the GNU General Public License, incor' | |||
|
12 | 12 | |
|
13 | 13 | from node import bin, hex, nullid, nullrev, short |
|
14 | 14 | from i18n import _ |
|
15 | import changegroup, errno, ancestor, mdiff | |
|
15 | import changegroup, errno, ancestor, mdiff, parsers | |
|
16 | 16 | import struct, util, zlib |
|
17 | 17 | |
|
18 | 18 | _pack = struct.pack |
@@ -374,38 +374,9 b' class revlogio(object):' | |||
|
374 | 374 | index[0] = e |
|
375 | 375 | return index, nodemap, None |
|
376 | 376 | |
|
377 | s = self.size | |
|
378 | cache = None | |
|
379 | index = [] | |
|
380 | nodemap = {nullid: nullrev} | |
|
381 | n = off = 0 | |
|
382 | # if we're not using lazymap, always read the whole index | |
|
383 | 377 | data = fp.read() |
|
384 | l = len(data) - s | |
|
385 | append = index.append | |
|
386 | if inline: | |
|
387 | cache = (0, data) | |
|
388 | while off <= l: | |
|
389 | e = _unpack(indexformatng, data[off:off + s]) | |
|
390 | nodemap[e[7]] = n | |
|
391 | append(e) | |
|
392 | n += 1 | |
|
393 | if e[1] < 0: | |
|
394 | break | |
|
395 | off += e[1] + s | |
|
396 | else: | |
|
397 | while off <= l: | |
|
398 | e = _unpack(indexformatng, data[off:off + s]) | |
|
399 | nodemap[e[7]] = n | |
|
400 | append(e) | |
|
401 | n += 1 | |
|
402 | off += s | |
|
403 | ||
|
404 | e = list(index[0]) | |
|
405 | type = gettype(e[0]) | |
|
406 | e[0] = offset_type(0, type) | |
|
407 | index[0] = e | |
|
408 | ||
|
378 | # call the C implementation to parse the index data | |
|
379 | index, nodemap, cache = parsers.parse_index(data, inline) | |
|
409 | 380 | return index, nodemap, cache |
|
410 | 381 | |
|
411 | 382 | def packentry(self, entry, node, version, rev): |
@@ -492,8 +463,10 b' class revlog(object):' | |||
|
492 | 463 | d = self._io.parseindex(f, self._inline) |
|
493 | 464 | self.index, self.nodemap, self._chunkcache = d |
|
494 | 465 | |
|
495 | # add the magic null revision at -1 | |
|
496 | self.index.append((0, 0, 0, -1, -1, -1, -1, nullid)) | |
|
466 | # add the magic null revision at -1 (if it hasn't been done already) | |
|
467 | if (self.index == [] or isinstance(self.index, lazyindex) or | |
|
468 | self.index[-1][7] != nullid) : | |
|
469 | self.index.append((0, 0, 0, -1, -1, -1, -1, nullid)) | |
|
497 | 470 | |
|
498 | 471 | def _loadindex(self, start, end): |
|
499 | 472 | """load a block of indexes all at once from the lazy parser""" |
General Comments 0
You need to be logged in to leave comments.
Login now