Show More
@@ -9,6 +9,25 b' from i18n import _' | |||||
9 | import mdiff, parsers, error, revlog, util |
|
9 | import mdiff, parsers, error, revlog, util | |
10 | import array, struct |
|
10 | import array, struct | |
11 |
|
11 | |||
|
12 | # Pure Python fallback | |||
|
13 | def _parsemanifest(mfdict, fdict, lines): | |||
|
14 | bin = revlog.bin | |||
|
15 | for l in lines.splitlines(): | |||
|
16 | f, n = l.split('\0') | |||
|
17 | if len(n) > 40: | |||
|
18 | fdict[f] = n[40:] | |||
|
19 | mfdict[f] = bin(n[:40]) | |||
|
20 | else: | |||
|
21 | mfdict[f] = bin(n) | |||
|
22 | ||||
|
23 | def _parse(lines): | |||
|
24 | mfdict = manifestdict() | |||
|
25 | try: | |||
|
26 | parsers.parse_manifest(mfdict, mfdict._flags, lines) | |||
|
27 | except AttributeError: | |||
|
28 | _parsemanifest(mfdict, mfdict._flags, lines) | |||
|
29 | return mfdict | |||
|
30 | ||||
12 | class manifestdict(dict): |
|
31 | class manifestdict(dict): | |
13 | def __init__(self): |
|
32 | def __init__(self): | |
14 | self._flags = {} |
|
33 | self._flags = {} | |
@@ -217,25 +236,6 b' def _addlistdelta(addlist, x):' | |||||
217 | + content for start, end, content in x) |
|
236 | + content for start, end, content in x) | |
218 | return deltatext, newaddlist |
|
237 | return deltatext, newaddlist | |
219 |
|
238 | |||
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 |
|
||||
231 | def _parse(lines): |
|
|||
232 | mfdict = manifestdict() |
|
|||
233 | try: |
|
|||
234 | parsers.parse_manifest(mfdict, mfdict._flags, lines) |
|
|||
235 | except AttributeError: |
|
|||
236 | _parsemanifest(mfdict, mfdict._flags, lines) |
|
|||
237 | return mfdict |
|
|||
238 |
|
||||
239 | class manifest(revlog.revlog): |
|
239 | class manifest(revlog.revlog): | |
240 | def __init__(self, opener): |
|
240 | def __init__(self, opener): | |
241 | # 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 |
General Comments 0
You need to be logged in to leave comments.
Login now