manifest: move parsing functions up in file
authorAugie Fackler <augie@google.com>
Sat, 07 Mar 2015 11:42:05 -0500
changeset 24223 b4df0d0c49e7
parent 24222 02d7b5cd373b
child 24224 d71837d06597
manifest: move parsing functions up in file These functions are about to change signature and be hidden inside the manifestdict constructor. Doing the code motion now as an isolated change to make things easier to review.
mercurial/manifest.py
--- a/mercurial/manifest.py	Tue Feb 10 15:59:12 2015 -0500
+++ b/mercurial/manifest.py	Sat Mar 07 11:42:05 2015 -0500
@@ -9,6 +9,25 @@
 import mdiff, parsers, error, revlog, util
 import array, struct
 
+# Pure Python fallback
+def _parsemanifest(mfdict, fdict, lines):
+    bin = revlog.bin
+    for l in lines.splitlines():
+        f, n = l.split('\0')
+        if len(n) > 40:
+            fdict[f] = n[40:]
+            mfdict[f] = bin(n[:40])
+        else:
+            mfdict[f] = bin(n)
+
+def _parse(lines):
+    mfdict = manifestdict()
+    try:
+        parsers.parse_manifest(mfdict, mfdict._flags, lines)
+    except AttributeError:
+        _parsemanifest(mfdict, mfdict._flags, lines)
+    return mfdict
+
 class manifestdict(dict):
     def __init__(self):
         self._flags = {}
@@ -217,25 +236,6 @@
                    + content for start, end, content in x)
     return deltatext, newaddlist
 
-# Pure Python fallback
-def _parsemanifest(mfdict, fdict, lines):
-    bin = revlog.bin
-    for l in lines.splitlines():
-        f, n = l.split('\0')
-        if len(n) > 40:
-            fdict[f] = n[40:]
-            mfdict[f] = bin(n[:40])
-        else:
-            mfdict[f] = bin(n)
-
-def _parse(lines):
-    mfdict = manifestdict()
-    try:
-        parsers.parse_manifest(mfdict, mfdict._flags, lines)
-    except AttributeError:
-        _parsemanifest(mfdict, mfdict._flags, lines)
-    return mfdict
-
 class manifest(revlog.revlog):
     def __init__(self, opener):
         # During normal operations, we expect to deal with not more than four