Skip to main content

Module rev

Module rev 

Source
Expand description

Build a code graph from a git revision (git-archive → tempdir → build), without disturbing the working tree. Exposed as code_tree.build(rev=…). Build a code graph from a git revision without disturbing the working tree.

git archive <rev> streams a tar of exactly the tracked files at that revision — it never touches HEAD or the working tree, and it only emits committed files, so untracked junk and .gitignored paths are absent for free (a superset of .gitignore semantics). We extract that tar into a tempfile::tempdir() and run the ordinary build pipeline (crate::code_tree::builder::run_with_options) over it unchanged — zero parser changes, zero walk changes. The existing manifest::walk_filter still runs on the extracted tree, so any committed node_modules / vendored build output is dropped on top.

Reuses the established git-shelling convention from repo.rs (std::process::Command, list args, no shell).

Functions§

archive_and_build
Build a code graph from src_dir as it existed at git revision rev.
build_code_tree_revs
Build one merged code graph spanning revs (git revspecs — tags, SHAs, HEAD), oldest → newest in list order.
dedup_revs
Collapse a requested rev-label list to its order-preserving unique form (first occurrence wins). A duplicate label resolves to the same tree, so re-folding it only inflates the per-entity revs/rev_fp lists and the provenance banner. Shared by the core builder and the MCP activation wrapper so both agree on the canonical label set.