match: add visitchildrenset complement to visitdir
`visitdir(d)` lets a caller query whether the directory is part of the matcher.
It can receive a response of 'all' (yes, and all children, you can stop calling
visitdir now), False (no, and no children either), or True (yes, either
something in this directory or a child is part of the matcher).
`visitchildrenset(d)` augments that by instead of returning True, it returns a
list of items to actually investigate. With this, code can be modified from:
for f in self.all_items:
if match.visitdir(self.dir + '/' + f):
<do stuff>
to be:
for f in self.all_items.intersect(match.visitchildrenset(self.dir)):
<do stuff>
use of this function can provide significant performance improvements,
especially when using narrow (so that the matcher is much smaller than the stuff
we see on disk) and/or treemanifests (so that we can avoid loading manifests for
trees that aren't part of the matcher).
Differential Revision: https://phab.mercurial-scm.org/D4130
Create an empty repo:
$ hg init a
$ cd a
Try some commands:
$ hg log
$ hg grep wah
[1]
$ hg manifest
$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
0 files, 0 changesets, 0 total revisions
Check the basic files created:
$ ls .hg
00changelog.i
requires
store
Should be empty:
$ ls .hg/store
Poke at a clone:
$ cd ..
$ hg clone a b
updating to branch default
0 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cd b
$ hg verify
checking changesets
checking manifests
crosschecking files in changesets and manifests
checking files
0 files, 0 changesets, 0 total revisions
$ ls .hg
00changelog.i
hgrc
requires
store
Should be empty:
$ ls .hg/store
$ cd ..