Show More
@@ -677,6 +677,9 b' class differencematcher(basematcher):' | |||
|
677 | 677 | def visitdir(self, dir): |
|
678 | 678 | if self._m2.visitdir(dir) == 'all': |
|
679 | 679 | return False |
|
680 | elif not self._m2.visitdir(dir): | |
|
681 | # m2 does not match dir, we can return 'all' here if possible | |
|
682 | return self._m1.visitdir(dir) | |
|
680 | 683 | return bool(self._m1.visitdir(dir)) |
|
681 | 684 | |
|
682 | 685 | def visitchildrenset(self, dir): |
@@ -255,20 +255,19 b' class DifferenceMatcherTests(unittest.Te' | |||
|
255 | 255 | m1 = matchmod.alwaysmatcher(b'', b'') |
|
256 | 256 | m2 = matchmod.nevermatcher(b'', b'') |
|
257 | 257 | dm = matchmod.differencematcher(m1, m2) |
|
258 |
# dm should be equivalent to a alwaysmatcher. |
|
|
259 | # nevermatcher, we could return 'all' for these. | |
|
258 | # dm should be equivalent to a alwaysmatcher. | |
|
260 | 259 | # |
|
261 | 260 | # We're testing Equal-to-True instead of just 'assertTrue' since |
|
262 | 261 | # assertTrue does NOT verify that it's a bool, just that it's truthy. |
|
263 | 262 | # While we may want to eventually make these return 'all', they should |
|
264 | 263 | # not currently do so. |
|
265 |
self.assertEqual(dm.visitdir(b'.'), |
|
|
266 |
self.assertEqual(dm.visitdir(b'dir'), |
|
|
267 |
self.assertEqual(dm.visitdir(b'dir/subdir'), |
|
|
268 |
self.assertEqual(dm.visitdir(b'dir/subdir/z'), |
|
|
269 |
self.assertEqual(dm.visitdir(b'dir/foo'), |
|
|
270 |
self.assertEqual(dm.visitdir(b'dir/subdir/x'), |
|
|
271 |
self.assertEqual(dm.visitdir(b'folder'), |
|
|
264 | self.assertEqual(dm.visitdir(b'.'), 'all') | |
|
265 | self.assertEqual(dm.visitdir(b'dir'), 'all') | |
|
266 | self.assertEqual(dm.visitdir(b'dir/subdir'), 'all') | |
|
267 | self.assertEqual(dm.visitdir(b'dir/subdir/z'), 'all') | |
|
268 | self.assertEqual(dm.visitdir(b'dir/foo'), 'all') | |
|
269 | self.assertEqual(dm.visitdir(b'dir/subdir/x'), 'all') | |
|
270 | self.assertEqual(dm.visitdir(b'folder'), 'all') | |
|
272 | 271 | |
|
273 | 272 | def testVisitchildrensetM2never(self): |
|
274 | 273 | m1 = matchmod.alwaysmatcher(b'', b'') |
@@ -295,9 +294,8 b' class DifferenceMatcherTests(unittest.Te' | |||
|
295 | 294 | # an 'all' pattern, just True. |
|
296 | 295 | self.assertEqual(dm.visitdir(b'dir/subdir/z'), True) |
|
297 | 296 | self.assertEqual(dm.visitdir(b'dir/subdir/x'), True) |
|
298 | # OPT: We could return 'all' for these. | |
|
299 |
self.assertEqual(dm.visitdir(b' |
|
|
300 | self.assertEqual(dm.visitdir(b'folder'), True) | |
|
297 | self.assertEqual(dm.visitdir(b'dir/foo'), 'all') | |
|
298 | self.assertEqual(dm.visitdir(b'folder'), 'all') | |
|
301 | 299 | |
|
302 | 300 | def testVisitchildrensetM2SubdirPrefix(self): |
|
303 | 301 | m1 = matchmod.alwaysmatcher(b'', b'') |
@@ -322,7 +320,7 b' class DifferenceMatcherTests(unittest.Te' | |||
|
322 | 320 | dm = matchmod.differencematcher(m1, m2) |
|
323 | 321 | self.assertEqual(dm.visitdir(b'.'), True) |
|
324 | 322 | self.assertEqual(dm.visitdir(b'dir'), True) |
|
325 |
self.assertEqual(dm.visitdir(b'dir/subdir'), |
|
|
323 | self.assertEqual(dm.visitdir(b'dir/subdir'), 'all') | |
|
326 | 324 | self.assertFalse(dm.visitdir(b'dir/foo')) |
|
327 | 325 | self.assertFalse(dm.visitdir(b'folder')) |
|
328 | 326 | # OPT: We should probably return False for these; we don't because |
General Comments 0
You need to be logged in to leave comments.
Login now