This is an archive of the discontinued Mercurial Phabricator instance.

includematcher: separate "parents" from "dirs"
ClosedPublic

Authored by spectral on Aug 6 2018, 2:50 PM.

Details

Summary

A future patch will make use of this separation so that we can make more
intelligent decisions about what to investigate/load when the matcher is in use.

Currently, even with this patch, we typically use the 'visitdir' call to identify if
we can skip some directory, something along the lines of:

for f in all_items:
    if match.visitdir(f):
       <do stuff>

This can be slower than we'd like if there are a lot of items; it requires N
calls to match.visitdir in the best case. Commonly, especially with 'narrow',
we have a situation where we do some work for the directory, possibly just
loading it from disk (when using treemanifests) and then check if we should be
interacting with it at all, which can be a huge slowdown in some pathological
cases.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

spectral created this revision.Aug 6 2018, 2:50 PM
spectral planned changes to this revision.Aug 6 2018, 3:56 PM
spectral updated this revision to Diff 10016.Aug 6 2018, 5:17 PM
yuja added a subscriber: yuja.Aug 8 2018, 11:16 AM

-def _rootsanddirs(kindpats):
+def _rootsdirsandparents(kindpats):

'''Returns roots and exact directories from patterns.
roots are directories to match recursively, whereas exact directories should
be matched non-recursively. The returned (roots, dirs) tuple will also
include directories that need to be implicitly considered as either, such as
parent directories.

Can you update the doc to reflect this change?

This revision was automatically updated to reflect the committed changes.