##// END OF EJS Templates
manifest: move pure parsing code out of pure...
Matt Mackall -
r24215:feddc528 default
parent child Browse files
Show More
@@ -217,9 +217,23 b' def _addlistdelta(addlist, x):'
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):
@@ -5,7 +5,7 b''
5 # This software may be used and distributed according to the terms of the
5 # This software may be used and distributed according to the terms of the
6 # GNU General Public License version 2 or any later version.
6 # GNU General Public License version 2 or any later version.
7
7
8 from mercurial.node import bin, nullid
8 from mercurial.node import nullid
9 from mercurial import util
9 from mercurial import util
10 import struct, zlib, cStringIO
10 import struct, zlib, cStringIO
11
11
@@ -21,15 +21,6 b' def dirstatetuple(*x):'
21 # x is a tuple
21 # x is a tuple
22 return x
22 return x
23
23
24 def parse_manifest(mfdict, fdict, lines):
25 for l in lines.splitlines():
26 f, n = l.split('\0')
27 if len(n) > 40:
28 fdict[f] = n[40:]
29 mfdict[f] = bin(n[:40])
30 else:
31 mfdict[f] = bin(n)
32
33 def parse_index2(data, inline):
24 def parse_index2(data, inline):
34 def gettype(q):
25 def gettype(q):
35 return int(q & 0xFFFF)
26 return int(q & 0xFFFF)
General Comments 0
You need to be logged in to leave comments. Login now