##// END OF EJS Templates
manifest: speed up creation of the manifestdict...
Matt Mackall -
r4995:e45fc5d0 default
parent child Browse files
Show More
@@ -23,10 +23,6 b' class manifestdict(dict):'
23 def linkf(self, f):
23 def linkf(self, f):
24 "test for symlink in manifest flags"
24 "test for symlink in manifest flags"
25 return "l" in self.flags(f)
25 return "l" in self.flags(f)
26 def rawset(self, f, entry):
27 self[f] = bin(entry[:40])
28 fl = entry[40:-1]
29 if fl: self._flags[f] = fl
30 def set(self, f, execf=False, linkf=False):
26 def set(self, f, execf=False, linkf=False):
31 if linkf: self._flags[f] = "l"
27 if linkf: self._flags[f] = "l"
32 elif execf: self._flags[f] = "x"
28 elif execf: self._flags[f] = "x"
@@ -40,16 +36,19 b' class manifest(revlog):'
40 self.listcache = None
36 self.listcache = None
41 revlog.__init__(self, opener, "00manifest.i")
37 revlog.__init__(self, opener, "00manifest.i")
42
38
43 def parselines(self, lines):
39 def parse(self, lines):
44 for l in lines.splitlines(1):
40 mfdict = manifestdict()
45 yield l.split('\0')
41 for l in lines.splitlines():
42 f, n = l.split('\0')
43 if len(n) > 40:
44 mfdict._flags[f] = n[40:]
45 mfdict[f] = bin(n[:40])
46 else:
47 mfdict[f] = bin(n)
48 return mfdict
46
49
47 def readdelta(self, node):
50 def readdelta(self, node):
48 delta = mdiff.patchtext(self.delta(node))
51 return self.parse(mdiff.patchtext(self.delta(node)))
49 deltamap = manifestdict()
50 for f, n in self.parselines(delta):
51 deltamap.rawset(f, n)
52 return deltamap
53
52
54 def read(self, node):
53 def read(self, node):
55 if node == nullid: return manifestdict() # don't upset local cache
54 if node == nullid: return manifestdict() # don't upset local cache
@@ -57,9 +56,7 b' class manifest(revlog):'
57 return self.mapcache[1]
56 return self.mapcache[1]
58 text = self.revision(node)
57 text = self.revision(node)
59 self.listcache = array.array('c', text)
58 self.listcache = array.array('c', text)
60 mapping = manifestdict()
59 mapping = self.parse(text)
61 for f, n in self.parselines(text):
62 mapping.rawset(f, n)
63 self.mapcache = (node, mapping)
60 self.mapcache = (node, mapping)
64 return mapping
61 return mapping
65
62
@@ -12,11 +12,9 b' import binascii'
12 nullrev = -1
12 nullrev = -1
13 nullid = "\0" * 20
13 nullid = "\0" * 20
14
14
15 def hex(node):
15 # This ugly style has a noticeable effect in manifest parsing
16 return binascii.hexlify(node)
16 hex = binascii.hexlify
17
17 bin = binascii.unhexlify
18 def bin(node):
19 return binascii.unhexlify(node)
20
18
21 def short(node):
19 def short(node):
22 return hex(node[:6])
20 return hex(node[:6])
General Comments 0
You need to be logged in to leave comments. Login now