Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
24214:a5f1bccd2996 | 24215:feddc5284724 |
---|---|
215 | 215 |
216 deltatext = "".join(struct.pack(">lll", start, end, len(content)) | 216 deltatext = "".join(struct.pack(">lll", start, end, len(content)) |
217 + content for start, end, content in x) | 217 + content for start, end, content in x) |
218 return deltatext, newaddlist | 218 return deltatext, newaddlist |
219 | 219 |
220 # Pure Python fallback | |
221 def _parsemanifest(mfdict, fdict, lines): | |
222 bin = revlog.bin | |
223 for l in lines.splitlines(): | |
224 f, n = l.split('\0') | |
225 if len(n) > 40: | |
226 fdict[f] = n[40:] | |
227 mfdict[f] = bin(n[:40]) | |
228 else: | |
229 mfdict[f] = bin(n) | |
230 | |
220 def _parse(lines): | 231 def _parse(lines): |
221 mfdict = manifestdict() | 232 mfdict = manifestdict() |
222 parsers.parse_manifest(mfdict, mfdict._flags, lines) | 233 try: |
234 parsers.parse_manifest(mfdict, mfdict._flags, lines) | |
235 except AttributeError: | |
236 _parsemanifest(mfdict, mfdict._flags, lines) | |
223 return mfdict | 237 return mfdict |
224 | 238 |
225 class manifest(revlog.revlog): | 239 class manifest(revlog.revlog): |
226 def __init__(self, opener): | 240 def __init__(self, opener): |
227 # During normal operations, we expect to deal with not more than four | 241 # During normal operations, we expect to deal with not more than four |