[PATCH 1 of 2] imported patch revlog.patch

Bernhard Leiner mailinglists.bleiner at gmail.com
Tue Oct 14 13:57:01 CDT 2008


# HG changeset patch
# User Bernhard Leiner <bleiner at gmail.com>
# Date 1224010352 -7200
# Node ID 19ccd16c56835f66f764535700320d00ef7a54ed
# Parent  0ed11838bd1a5102ce7ed7835754dfcf1322168d
imported patch revlog.patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -12,7 +12,7 @@
 
 from node import bin, hex, nullid, nullrev, short
 from i18n import _
-import changegroup, errno, ancestor, mdiff
+import changegroup, errno, ancestor, mdiff, parsers
 import struct, util, zlib
 
 _pack = struct.pack
@@ -374,38 +374,9 @@
             index[0] = e
             return index, nodemap, None
 
-        s = self.size
-        cache = None
-        index = []
-        nodemap =  {nullid: nullrev}
-        n = off = 0
-        # if we're not using lazymap, always read the whole index
         data = fp.read()
-        l = len(data) - s
-        append = index.append
-        if inline:
-            cache = (0, data)
-            while off <= l:
-                e = _unpack(indexformatng, data[off:off + s])
-                nodemap[e[7]] = n
-                append(e)
-                n += 1
-                if e[1] < 0:
-                    break
-                off += e[1] + s
-        else:
-            while off <= l:
-                e = _unpack(indexformatng, data[off:off + s])
-                nodemap[e[7]] = n
-                append(e)
-                n += 1
-                off += s
-
-        e = list(index[0])
-        type = gettype(e[0])
-        e[0] = offset_type(0, type)
-        index[0] = e
-
+        # call the C implementation to parse the index data
+        index, nodemap, cache = parsers.parse_index(data, inline)
         return index, nodemap, cache
 
     def packentry(self, entry, node, version, rev):


More information about the Mercurial-devel mailing list