mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 08:47:12 +03:00
match: make differencematcher.visitdir slightly more efficient
Summary: At the moment differencematcher.visitdir never returns "all". This diff changes it to return all in the case if self._m2 doesn't visit the directory at all and self.m1.visitdir(dir) returns "all". This makes sense - if m1 visits all files in the directory and m2 doesn't exclude any file then it's safe to return all in this case. This optimization will be used in the next diff. Reviewed By: sfilipco Differential Revision: D24725903 fbshipit-source-id: 2a049cfb1ea4878331e8640cbb20af74da86a1a1
This commit is contained in:
parent
5b92b6978e
commit
abfe3d84c7
@ -1050,6 +1050,9 @@ class differencematcher(basematcher):
|
||||
|
||||
def visitdir(self, dir):
|
||||
dir = normalizerootdir(dir, "visitdir")
|
||||
if not self._m2.visitdir(dir):
|
||||
return self._m1.visitdir(dir)
|
||||
|
||||
if self._m2.visitdir(dir) == "all":
|
||||
# There's a bug here: If m1 matches file 'dir/file' and m2 excludes
|
||||
# 'dir' (recursively), we should still visit 'dir' due to the
|
||||
|
Loading…
Reference in New Issue
Block a user