diff --git a/mercurial/manifest.py b/mercurial/manifest.py --- a/mercurial/manifest.py +++ b/mercurial/manifest.py @@ -9,6 +9,25 @@ from i18n import _ 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 @@ 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() - 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