##// END OF EJS Templates
manifestdict: add a new method to intersect with a set of files...
Siddharth Agarwal -
r21879:090dcaaf default
parent child Browse files
Show More
@@ -25,6 +25,18 b' class manifestdict(dict):'
25 self._flags[f] = flags
25 self._flags[f] = flags
26 def copy(self):
26 def copy(self):
27 return manifestdict(self, dict.copy(self._flags))
27 return manifestdict(self, dict.copy(self._flags))
28 def intersectfiles(self, files):
29 '''make a new manifestdict with the intersection of self with files
30
31 The algorithm assumes that files is much smaller than self.'''
32 ret = manifestdict()
33 for fn in files:
34 if fn in self:
35 ret[fn] = self[fn]
36 flags = self._flags.get(fn, None)
37 if flags:
38 ret._flags[fn] = flags
39 return ret
28 def flagsdiff(self, d2):
40 def flagsdiff(self, d2):
29 return dicthelpers.diff(self._flags, d2._flags, "")
41 return dicthelpers.diff(self._flags, d2._flags, "")
30
42
General Comments 0
You need to be logged in to leave comments. Login now