@@ -693,11 +693,10 @@ def refresh_file(module: str, path: str) -> list[str]:
693693
694694 # Find all original modules in graph that were not reached -- they are deleted.
695695 to_delete = []
696- seen_and_ancestors = self ._seen_and_ancestors (seen )
697696 for module_id in orig_modules :
698697 if module_id not in graph :
699698 continue
700- if module_id not in seen_and_ancestors :
699+ if module_id not in seen :
701700 module_path = graph [module_id ].path
702701 assert module_path is not None
703702 to_delete .append ((module_id , module_path ))
@@ -725,29 +724,6 @@ def refresh_file(module: str, path: str) -> list[str]:
725724
726725 return messages
727726
728- def _seen_and_ancestors (self , seen : set [str ]) -> set [str ]:
729- """Return the set of seen modules along with any ancestors not already in the set.
730-
731- For example, given this set:
732-
733- {"foo", "foo.bar", "a.b.c"}
734-
735- ... we would expect this set to be returned:
736-
737- {"foo", "foo.bar", "a.b.c", "a.b", "a"}
738-
739- This is used to stop us from deleting ancestor modules from the graph
740- when their descendants have been seen.
741- """
742- seen_paths = seen .copy ()
743- for module_path in seen :
744- while module_path := module_path .rpartition ("." )[0 ]:
745- if module_path in seen_paths :
746- break
747- else :
748- seen_paths .add (module_path )
749- return seen_paths
750-
751727 def find_reachable_changed_modules (
752728 self ,
753729 roots : list [BuildSource ],
0 commit comments