D4130: match: add visitchildrenset complement to visitdir
spectral (Kyle Lippincott)
phabricator at mercurial-scm.org
Wed Aug 8 20:01:58 EDT 2018
spectral added a comment.
In https://phab.mercurial-scm.org/D4130#64345, @yuja wrote:
> > + 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()
Indeed, adding a comment.
>
>
>> @@ -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()`?
Yikes, good catch.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4130
To: spectral, #hg-reviewers
Cc: yuja, mercurial-devel
More information about the Mercurial-devel
mailing list