Show More
@@ -11,38 +11,26 b' from demandload import *' | |||
|
11 | 11 | demandload(globals(), "array bisect struct") |
|
12 | 12 | |
|
13 | 13 | class manifestdict(dict): |
|
14 | def __init__(self, mapping={}): | |
|
14 | def __init__(self, mapping={}, flags={}): | |
|
15 | 15 | dict.__init__(self, mapping) |
|
16 | def __getitem__(self, f): | |
|
17 | return self.node(f) | |
|
18 | def get(self, f, default=None): | |
|
19 | try: | |
|
20 | return dict.__getitem__(self, f)[:20] | |
|
21 | except KeyError: | |
|
22 | return default | |
|
23 | def __setitem__(self, f, node): | |
|
24 | fl = self.flags(f) | |
|
25 | dict.__setitem__(self, f, node + fl) | |
|
26 | def node(self, f): | |
|
27 | return dict.__getitem__(self, f)[:20] | |
|
16 | self._flags = flags | |
|
28 | 17 | def flags(self, f): |
|
29 |
return |
|
|
18 | return self._flags.get(f, "") | |
|
30 | 19 | def execf(self, f): |
|
31 | 20 | "test for executable in manifest flags" |
|
32 | 21 | return "x" in self.flags(f) |
|
33 | 22 | def linkf(self, f): |
|
34 | 23 | "test for symlink in manifest flags" |
|
35 | 24 | return "l" in self.flags(f) |
|
36 |
def rawset(self, f, |
|
|
37 | dict.__setitem__(self, f, node + flags) | |
|
25 | def rawset(self, f, entry): | |
|
26 | self[f] = bin(entry[:40]) | |
|
27 | fl = entry[40:-1] | |
|
28 | if fl: self._flags[f] = fl | |
|
38 | 29 | def set(self, f, execf=False, linkf=False): |
|
39 | n = dict.get(self, f, nullid)[:20] | |
|
40 | fl = "" | |
|
41 | if execf: fl = "x" | |
|
42 | if linkf: fl = "l" | |
|
43 | dict.__setitem__(self, f, n + fl) | |
|
30 | if execf: self._flags[f] = "x" | |
|
31 | if linkf: self._flags[f] = "x" | |
|
44 | 32 | def copy(self): |
|
45 | return manifestdict(dict.copy(self)) | |
|
33 | return manifestdict(dict.copy(self), dict.copy(self._flags)) | |
|
46 | 34 | |
|
47 | 35 | class manifest(revlog): |
|
48 | 36 | def __init__(self, opener, defversion=REVLOGV0): |
@@ -61,7 +49,7 b' class manifest(revlog):' | |||
|
61 | 49 | mapping = manifestdict() |
|
62 | 50 | for l in lines: |
|
63 | 51 | (f, n) = l.split('\0') |
|
64 |
mapping.rawset(f, |
|
|
52 | mapping.rawset(f, n) | |
|
65 | 53 | self.mapcache = (node, mapping) |
|
66 | 54 | return mapping |
|
67 | 55 |
General Comments 0
You need to be logged in to leave comments.
Login now