Fix quadratic behavior in Repo._collect_stages() (#3932)

This commit is contained in:
Alexander Schepanovski
2020-06-02 16:56:49 +03:00
committed by GitHub
parent 7504b68c12
commit fd65f44b7f
+5 -6
View File
@@ -527,14 +527,13 @@ class Repo:
for root, dirs, files in self.tree.walk(self.root_dir):
for file_name in filter(is_valid_filename, files):
path = os.path.join(root, file_name)
stages.extend(self.get_stages(path))
new_stages = self.get_stages(os.path.join(root, file_name))
stages.extend(new_stages)
outs.update(
out.fspath
for stage in stages
for out in (
out for out in stage.outs if out.scheme == "local"
)
for stage in new_stages
for out in stage.outs
if out.scheme == "local"
)
dirs[:] = [d for d in dirs if os.path.join(root, d) not in outs]
return stages