manifest: move manifest parsing to module-level
authorAugie Fackler <raf@durin42.com>
Thu, 25 Sep 2014 14:13:31 -0400
changeset 22786 079a0ed5ee4a
parent 22785 abc44fcc9c57
child 22787 4a13849ca359
manifest: move manifest parsing to module-level We'll need this in the sharded manifest hashing routine, and I need to tweak it anyway, so make it module-level now.
mercurial/manifest.py
--- a/mercurial/manifest.py	Wed Sep 24 15:14:44 2014 -0400
+++ b/mercurial/manifest.py	Thu Sep 25 14:13:31 2014 -0400
@@ -70,6 +70,10 @@
                    + content for start, end, content in x)
     return deltatext, newaddlist
 
+def _parse(lines):
+    mfdict = manifestdict()
+    parsers.parse_manifest(mfdict, mfdict._flags, lines)
+    return mfdict
 
 class manifest(revlog.revlog):
     def __init__(self, opener):
@@ -78,14 +82,9 @@
         self._mancache = util.lrucachedict(4)
         revlog.revlog.__init__(self, opener, "00manifest.i")
 
-    def parse(self, lines):
-        mfdict = manifestdict()
-        parsers.parse_manifest(mfdict, mfdict._flags, lines)
-        return mfdict
-
     def readdelta(self, node):
         r = self.rev(node)
-        return self.parse(mdiff.patchtext(self.revdiff(self.deltaparent(r), r)))
+        return _parse(mdiff.patchtext(self.revdiff(self.deltaparent(r), r)))
 
     def readfast(self, node):
         '''use the faster of readdelta or read'''
@@ -102,7 +101,7 @@
             return self._mancache[node][0]
         text = self.revision(node)
         arraytext = array.array('c', text)
-        mapping = self.parse(text)
+        mapping = _parse(text)
         self._mancache[node] = (mapping, arraytext)
         return mapping