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