diff mercurial/manifest.py @ 24215:feddc5284724

manifest: move pure parsing code out of pure This lets us transition more smoothly.
author Matt Mackall <mpm@selenic.com>
date Fri, 06 Mar 2015 17:00:42 -0600
parents cd66080ef6d4
children b4df0d0c49e7
line wrap: on
line diff
--- a/mercurial/manifest.py	Tue Jan 13 14:31:38 2015 -0800
+++ b/mercurial/manifest.py	Fri Mar 06 17:00:42 2015 -0600
@@ -217,9 +217,23 @@
                    + 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()
-    parsers.parse_manifest(mfdict, mfdict._flags, lines)
+    try:
+        parsers.parse_manifest(mfdict, mfdict._flags, lines)
+    except AttributeError:
+        _parsemanifest(mfdict, mfdict._flags, lines)
     return mfdict
 
 class manifest(revlog.revlog):