Show More
@@ -131,7 +131,7 b' class manifestdict(object):' | |||||
131 | def keys(self): |
|
131 | def keys(self): | |
132 | return list(self.iterkeys()) |
|
132 | return list(self.iterkeys()) | |
133 |
|
133 | |||
134 | def intersectfiles(self, files): |
|
134 | def _intersectfiles(self, files): | |
135 | '''make a new lazymanifest with the intersection of self with files |
|
135 | '''make a new lazymanifest with the intersection of self with files | |
136 |
|
136 | |||
137 | The algorithm assumes that files is much smaller than self.''' |
|
137 | The algorithm assumes that files is much smaller than self.''' | |
@@ -166,7 +166,7 b' class manifestdict(object):' | |||||
166 | files = match.files() |
|
166 | files = match.files() | |
167 | if (len(files) < 100 and (match.isexact() or |
|
167 | if (len(files) < 100 and (match.isexact() or | |
168 | (not match.anypats() and util.all(fn in self for fn in files)))): |
|
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 | lm = manifestdict('') |
|
171 | lm = manifestdict('') | |
172 | lm._lm = self._lm.filtercopy(match) |
|
172 | lm._lm = self._lm.filtercopy(match) | |
@@ -467,7 +467,7 b' class treemanifest(object):' | |||||
467 | copy._flags = dict.copy(self._flags) |
|
467 | copy._flags = dict.copy(self._flags) | |
468 | return copy |
|
468 | return copy | |
469 |
|
469 | |||
470 | def intersectfiles(self, files): |
|
470 | def _intersectfiles(self, files): | |
471 | '''make a new treemanifest with the intersection of self with files |
|
471 | '''make a new treemanifest with the intersection of self with files | |
472 |
|
472 | |||
473 | The algorithm assumes that files is much smaller than self.''' |
|
473 | The algorithm assumes that files is much smaller than self.''' | |
@@ -521,7 +521,7 b' class treemanifest(object):' | |||||
521 | files = match.files() |
|
521 | files = match.files() | |
522 | if (match.isexact() or |
|
522 | if (match.isexact() or | |
523 | (not match.anypats() and util.all(fn in self for fn in files))): |
|
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 | m = self.copy() |
|
526 | m = self.copy() | |
527 | for fn in m.keys(): |
|
527 | for fn in m.keys(): |
@@ -250,9 +250,13 b' class testmanifest(unittest.TestCase):' | |||||
250 | self.assertEqual(HUGE_MANIFEST_ENTRIES, len(m)) |
|
250 | self.assertEqual(HUGE_MANIFEST_ENTRIES, len(m)) | |
251 | self.assertEqual(len(m), len(list(m))) |
|
251 | self.assertEqual(len(m), len(list(m))) | |
252 |
|
252 | |||
253 |
def test |
|
253 | def testMatches(self): | |
254 | m = parsemanifest(A_HUGE_MANIFEST) |
|
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 | w = ('file1\0%sx\n' |
|
260 | w = ('file1\0%sx\n' | |
257 | 'file200\0%sl\n' |
|
261 | 'file200\0%sl\n' | |
258 | 'file300\0%s\n') % (HASH_2, HASH_1, HASH_1) |
|
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