diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -217,9 +217,23 @@ def _addlistdelta(addlist, x): + 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): diff --git a/mercurial/pure/parsers.py b/mercurial/pure/parsers.py --- a/mercurial/pure/parsers.py +++ b/mercurial/pure/parsers.py @@ -5,7 +5,7 @@ # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. -from mercurial.node import bin, nullid +from mercurial.node import nullid from mercurial import util import struct, zlib, cStringIO @@ -21,15 +21,6 @@ def dirstatetuple(*x): # x is a tuple return x -def parse_manifest(mfdict, fdict, lines): - 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_index2(data, inline): def gettype(q): return int(q & 0xFFFF)