[PATCH 2 of 3] [mq]: revlog.patch

Bernhard Leiner mailinglists.bleiner at gmail.com
Mon Oct 13 17:03:00 CDT 2008


# HG changeset patch
# User Bernhard Leiner <bleiner at gmail.com>
# Date 1223927225 -7200
# Node ID 617ee65a661886079337ecf115c931ebf10d432b
# Parent  653c58db5b1f043e45e860dfe922a26f4755504f
[mq]: revlog.patch

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -14,6 +14,7 @@
 from i18n import _
 import changegroup, errno, ancestor, mdiff
 import struct, util, zlib
+import revlog_c
 
 _pack = struct.pack
 _unpack = struct.unpack
@@ -374,38 +375,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 = revlog_c.parseindex(data, inline)
         return index, nodemap, cache
 
     def packentry(self, entry, node, version, rev):


More information about the Mercurial-devel mailing list