##// END OF EJS Templates
match: drop unnecessary adding of '' to set of dirs...
Martin von Zweigbergk -
r42533:38d85ec0 default
parent child Browse files
Show More
@@ -533,7 +533,7 b' class patternmatcher(basematcher):'
533
533
534 @propertycache
534 @propertycache
535 def _dirs(self):
535 def _dirs(self):
536 return set(util.dirs(self._fileset)) | {''}
536 return set(util.dirs(self._fileset))
537
537
538 def visitdir(self, dir):
538 def visitdir(self, dir):
539 dir = normalizerootdir(dir, 'visitdir')
539 dir = normalizerootdir(dir, 'visitdir')
@@ -691,7 +691,7 b' class exactmatcher(basematcher):'
691
691
692 @propertycache
692 @propertycache
693 def _dirs(self):
693 def _dirs(self):
694 return set(util.dirs(self._fileset)) | {''}
694 return set(util.dirs(self._fileset))
695
695
696 def visitdir(self, dir):
696 def visitdir(self, dir):
697 dir = normalizerootdir(dir, 'visitdir')
697 dir = normalizerootdir(dir, 'visitdir')
@@ -1007,7 +1007,7 b' class prefixdirmatcher(basematcher):'
1007
1007
1008 @propertycache
1008 @propertycache
1009 def _pathdirs(self):
1009 def _pathdirs(self):
1010 return set(util.finddirs(self._path)) | {''}
1010 return set(util.finddirs(self._path))
1011
1011
1012 def visitdir(self, dir):
1012 def visitdir(self, dir):
1013 if dir == self._path:
1013 if dir == self._path:
@@ -84,21 +84,21 b' class PatternMatcherTests(unittest.TestC'
84 def testVisitdirRootfilesin(self):
84 def testVisitdirRootfilesin(self):
85 m = matchmod.match(b'x', b'', patterns=[b'rootfilesin:dir/subdir'])
85 m = matchmod.match(b'x', b'', patterns=[b'rootfilesin:dir/subdir'])
86 assert isinstance(m, matchmod.patternmatcher)
86 assert isinstance(m, matchmod.patternmatcher)
87 self.assertTrue(m.visitdir(b''))
88 self.assertFalse(m.visitdir(b'dir/subdir/x'))
87 self.assertFalse(m.visitdir(b'dir/subdir/x'))
89 self.assertFalse(m.visitdir(b'folder'))
88 self.assertFalse(m.visitdir(b'folder'))
90 # FIXME: These should probably be True.
89 # FIXME: These should probably be True.
90 self.assertFalse(m.visitdir(b''))
91 self.assertFalse(m.visitdir(b'dir'))
91 self.assertFalse(m.visitdir(b'dir'))
92 self.assertFalse(m.visitdir(b'dir/subdir'))
92 self.assertFalse(m.visitdir(b'dir/subdir'))
93
93
94 def testVisitchildrensetRootfilesin(self):
94 def testVisitchildrensetRootfilesin(self):
95 m = matchmod.match(b'x', b'', patterns=[b'rootfilesin:dir/subdir'])
95 m = matchmod.match(b'x', b'', patterns=[b'rootfilesin:dir/subdir'])
96 assert isinstance(m, matchmod.patternmatcher)
96 assert isinstance(m, matchmod.patternmatcher)
97 self.assertEqual(m.visitchildrenset(b''), b'this')
98 self.assertEqual(m.visitchildrenset(b'dir/subdir/x'), set())
97 self.assertEqual(m.visitchildrenset(b'dir/subdir/x'), set())
99 self.assertEqual(m.visitchildrenset(b'folder'), set())
98 self.assertEqual(m.visitchildrenset(b'folder'), set())
100 # FIXME: These should probably be {'subdir'} and 'this', respectively,
99 # FIXME: These should probably be {'dir'}, {'subdir'} and 'this',
101 # or at least 'this' and 'this'.
100 # respectively, or at least 'this' for all three.
101 self.assertEqual(m.visitchildrenset(b''), set())
102 self.assertEqual(m.visitchildrenset(b'dir'), set())
102 self.assertEqual(m.visitchildrenset(b'dir'), set())
103 self.assertEqual(m.visitchildrenset(b'dir/subdir'), set())
103 self.assertEqual(m.visitchildrenset(b'dir/subdir'), set())
104
104
General Comments 0
You need to be logged in to leave comments. Login now