Skip to main content

Module ingest_git

Module ingest_git 

Source
Expand description

mushroomdb ingest-git <db> <repo>: build and maintain a graph of a git repository. First run ingests the whole history; later runs apply only the commits after the recorded GitSync head, so deletes and renames retract or move derived edges instead of leaving them stale.

Graph shape:

Labelkey (id)props
Authormailmap-resolved emailname, name_counts
Commitfull shamessage, ts, author_id, pr_id (with --prs)
Filepathpath, dir, ext, commits, n_commits, top_author_id, author_counts, plus the working-tree props in structure
Symbol"<path>#<qualified name>"see structure
PR"pr:<number>"number, title, url, merged_at, author_login
GitSync"__mushroomdb_git_sync__"sha, synced_at, repo, recurse, prs, structure, docs

Edges: user TOUCHED Commit→File and MERGED_AS PR→Commit, auto-FK AUTHOR Commit→Author, TOP_AUTHOR File→Author and PR Commit→PR, rule-derived CO_CHANGED File→File and KNOWS Author→File — and, from the working-tree pass, DEFINES, IMPORTS, CALLS and MENTIONS.

With --recurse-submodules each initialised submodule is walked as its own unit: its file keys carry the submodule’s path in the parent, and it resumes from its own GitSync marker.

Structs§

IngestGitOpts
IngestGitReport
SyncReport
What one run_sync did.

Constants§

BUSY_MESSAGE
What the CLI prints, and exits 3 on, when another process holds the store’s cross-process write lock. Nothing was written, so retrying is always safe.
DEFAULT_EXCLUDES
Applied when the user names no --exclude pattern of their own.
DEFAULT_MAX_COMMITS_PER_FILE
Cap on the commits list stored per file. Bounds both node size and the cost of the jaccard overlap the co_changed rule runs over that list.
SNAPSHOT_WAL_BYTES
WAL bytes past the last snapshot that make writing a new one worthwhile.
SYNCED_AT
Marker prop holding when this store last took data from the repository.

Functions§

format_ingest_git
format_sync
format_sync_json
One SyncReport as a single JSON object, for sync --json.
format_touch
run_ingest_git
run_sync
Bring the store up to date with the repository it was built from: the commits since the marker, then the working tree where it differs from HEAD.
run_touch
Re-extract exactly the files named, and nothing else.