@@ -620,6 +620,9 @@ def fine_grained_increment_follow_imports(
620
620
t1 = time .time ()
621
621
manager .log (f"fine-grained increment: find_changed: { t1 - t0 :.3f} s" )
622
622
623
+ # Track all modules encountered so far. New entries for all dependencies
624
+ # are added below by other module finding methods below. All dependencies
625
+ # in graph but not in `seen` are considered deleted at the end of this method.
623
626
seen = {source .module for source in sources }
624
627
625
628
# Find changed modules reachable from roots (or in roots) already in graph.
@@ -736,7 +739,9 @@ def find_reachable_changed_modules(
736
739
Args:
737
740
roots: modules where to start search from
738
741
graph: module graph to use for the search
739
- seen: modules we've seen before that won't be visited (mutated here!!)
742
+ seen: modules we've seen before that won't be visited (mutated here!!).
743
+ Needed to accumulate all modules encountered during update and remove
744
+ everything that no longer exists.
740
745
changed_paths: which paths have changed (stop search here and return any found)
741
746
742
747
Return (encountered reachable changed modules,
@@ -756,7 +761,8 @@ def find_reachable_changed_modules(
756
761
changed .append ((nxt .module , nxt .path ))
757
762
elif nxt .module in graph :
758
763
state = graph [nxt .module ]
759
- for dep in state .dependencies :
764
+ ancestors = state .ancestors or []
765
+ for dep in state .dependencies + ancestors :
760
766
if dep not in seen :
761
767
seen .add (dep )
762
768
worklist .append (BuildSource (graph [dep ].path , graph [dep ].id , followed = True ))
@@ -775,7 +781,9 @@ def find_added_suppressed(
775
781
"""Find suppressed modules that have been added (and not included in seen).
776
782
777
783
Args:
778
- seen: reachable modules we've seen before (mutated here!!)
784
+ seen: reachable modules we've seen before (mutated here!!).
785
+ Needed to accumulate all modules encountered during update and remove
786
+ everything that no longer exists.
779
787
780
788
Return suppressed, added modules.
781
789
"""
0 commit comments