Patchwork [3,of,5,manifest-cleanup] manifest: move manifest parsing to module-level

login
register
mail settings
Submitter Augie Fackler
Date Oct. 8, 2014, 5:06 p.m.
Message ID <10a4ddd5c5df656da859.1412788011@augie-macbookair>
Download mbox | patch
Permalink /patch/6156/
State Accepted
Headers show

Comments

Augie Fackler - Oct. 8, 2014, 5:06 p.m.
# HG changeset patch
# User Augie Fackler <raf@durin42.com>
# Date 1411668811 14400
#      Thu Sep 25 14:13:31 2014 -0400
# Node ID 10a4ddd5c5df656da859aceb84d7c424cc2b5c40
# Parent  ff79cf931d0105e1749e6edfd309d7ed303155b8
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.

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -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