D4130: match: add visitchildrenset complement to visitdir

Yuya Nishihara yuya at tcha.org
Wed Aug 8 11:06:59 EDT 2018


> +    def testVisitchildrensetRootfilesin(self):
> +        m = matchmod.match('x', '', patterns=['rootfilesin:dir/subdir'])
> +        assert isinstance(m, matchmod.patternmatcher)
> +        self.assertEqual(m.visitchildrenset('.'), 'this')
> +        self.assertEqual(m.visitchildrenset('dir/subdir/x'), set())
> +        self.assertEqual(m.visitchildrenset('folder'), set())

> +        self.assertEqual(m.visitchildrenset('dir'), set())
> +        self.assertEqual(m.visitchildrenset('dir/subdir'), set())

I assumed these two have the same bug as the one mentioned in testVisitdirRootfilesin()

> @@ -748,6 +903,14 @@
>              return self._matcher.visitdir(dir[len(self._pathprefix):])
>          return dir in self._pathdirs
>  
> +    def visitchildrenset(self, dir):
> +        if dir == self._path:
> +            return self._matcher.visitchildrenset('.')
> +        if dir.startswith(self._pathprefix):
> +            return self._matcher.visitchildrenset(dir[len(self._pathprefix):])
> +        if dir in self._pathdirs:
> +            return 'this'

Maybe missing `return set()`?


More information about the Mercurial-devel mailing list