##// END OF EJS Templates
manifest: make manifest.intersectfiles() internal...
Drew Gottlieb -
r24495:d2a3a280 default
parent child Browse files
Show More
@@ -131,7 +131,7 b' class manifestdict(object):'
131 131 def keys(self):
132 132 return list(self.iterkeys())
133 133
134 def intersectfiles(self, files):
134 def _intersectfiles(self, files):
135 135 '''make a new lazymanifest with the intersection of self with files
136 136
137 137 The algorithm assumes that files is much smaller than self.'''
@@ -166,7 +166,7 b' class manifestdict(object):'
166 166 files = match.files()
167 167 if (len(files) < 100 and (match.isexact() or
168 168 (not match.anypats() and util.all(fn in self for fn in files)))):
169 return self.intersectfiles(files)
169 return self._intersectfiles(files)
170 170
171 171 lm = manifestdict('')
172 172 lm._lm = self._lm.filtercopy(match)
@@ -467,7 +467,7 b' class treemanifest(object):'
467 467 copy._flags = dict.copy(self._flags)
468 468 return copy
469 469
470 def intersectfiles(self, files):
470 def _intersectfiles(self, files):
471 471 '''make a new treemanifest with the intersection of self with files
472 472
473 473 The algorithm assumes that files is much smaller than self.'''
@@ -521,7 +521,7 b' class treemanifest(object):'
521 521 files = match.files()
522 522 if (match.isexact() or
523 523 (not match.anypats() and util.all(fn in self for fn in files))):
524 return self.intersectfiles(files)
524 return self._intersectfiles(files)
525 525
526 526 m = self.copy()
527 527 for fn in m.keys():
@@ -250,9 +250,13 b' class testmanifest(unittest.TestCase):'
250 250 self.assertEqual(HUGE_MANIFEST_ENTRIES, len(m))
251 251 self.assertEqual(len(m), len(list(m)))
252 252
253 def testIntersectFiles(self):
253 def testMatches(self):
254 254 m = parsemanifest(A_HUGE_MANIFEST)
255 m2 = m.intersectfiles(['file1', 'file200', 'file300'])
255
256 match = matchmod.match('/', '',
257 ['file1', 'file200', 'file300'], exact=True)
258 m2 = m.matches(match)
259
256 260 w = ('file1\0%sx\n'
257 261 'file200\0%sl\n'
258 262 'file300\0%s\n') % (HASH_2, HASH_1, HASH_1)
General Comments 0
You need to be logged in to leave comments. Login now