feat: extract canonical graph traversal into muse/core/graph.py
Add iter_ancestors(), ancestor_ids(), and find_merge_base() as the single source of truth for all commit DAG traversal in Muse. TDD with 26 tests in tests/test_core_graph.py covering BFS ordering, dedup, multi-source, first_parent_only, exclude boundaries, max_commits cap, missing commits, diamond DAGs, and LCA edge cases.
Replace inline BFS in 8 sites: - blame.py: _walk_ancestry → iter_ancestors - rev_list.py: _exclude_set → ancestor_ids; _walk_from → iter_ancestors - range_diff.py: _exclude_set → ancestor_ids; _walk_range → iter_ancestors - commit_graph.py: _ancestors_of → ancestor_ids; main run BFS → iter_ancestors - merge_engine.py: find_merge_base → delegates to graph.find_merge_base - query_engine.py: _walk_history_bfs → iter_ancestors - pack.py: walk_commits inner loop → iter_ancestors - count_objects.py: _collect_reachable_ids → iter_ancestors
gc.py intentionally retains its raw-msgpack walk for schema-evolution robustness — documented as the sole sanctioned exception.
0 comments
muse hub commit comment sha256:b6bd084f73a3976352f97a4914e4fa1f0c0a108e04f417a8ea6d05147f4ede5d --body "your comment"
No comments yet. Be the first to start the discussion.