Skip to main content

Module diffstat

Module diffstat 

Source
Expand description

Renders a git diff --stat/jj diff --stat-style summary from per-file line counts, for sources that report changed files via their own API (Phabricator’s differential.querydiffs) or only an aggregate count (GitHub’s PR object) rather than a local git/jj diff.

Structs§

FileChange
One changed file’s line counts, as reported by a source’s API.

Functions§

format_diffstat
Render changes the way git diff --stat would: one path | N +++--- line per file (up to [MAX_FILES_SHOWN], widest bar capped at [MAX_BAR_WIDTH], +/- split proportionally to that file’s own additions/deletions), then a “N more files not shown” line if any were omitted, followed by a N files changed, X insertions(+), Y deletions(-) summary line (always counting every file, shown or not). Returns an empty string for no changes.
format_summary
Just the N files changed, X insertions(+), Y deletions(-) line, for sources that only expose aggregate counts (GitHub’s PR object) rather than a per-file breakdown.