module documentation

Generate diff statistics similar to git's --stat option.

This module provides functionality to parse unified diff output and generate statistics about changes, including: - Number of lines added and removed per file - Binary file detection - File rename detection - Formatted output similar to git diff --stat

Function diffstat Generate summary statistics from a git style diff ala (git diff tag1 tag2 --stat).
Function main Main entry point for diffstat command line tool.
Function parse_patch Parse a git style diff or patch to generate diff stats.
Constant _GIT_ADDED_START Undocumented
Constant _GIT_BINARY_START Undocumented
Constant _GIT_CHUNK_START Undocumented
Constant _GIT_DELETED_START Undocumented
Constant _GIT_HEADER_START Undocumented
Constant _GIT_RENAMEFROM_START Undocumented
Constant _GIT_RENAMETO_START Undocumented
Constant _GIT_UNCHANGED_START Undocumented
Variable _git_header_name Undocumented
def diffstat(lines: Sequence[bytes], max_width: int = 80) -> bytes:

Generate summary statistics from a git style diff ala (git diff tag1 tag2 --stat).

Returns: A byte string that lists the changed files with change
counts and histogram.
Parameters
lines:Sequence[bytes]list of byte string "lines" from the diff to be parsed
max_width:intmaximum line length for generating the summary statistics (default 80)
Returns
bytesUndocumented
def main() -> int:

Main entry point for diffstat command line tool.

Returns
intExit code (0 for success)
def parse_patch(lines: Sequence[bytes]) -> tuple[list[bytes], list[bool], list[tuple[int, int]]]:

Parse a git style diff or patch to generate diff stats.

Returns: A tuple (names, is_binary, counts) of three lists

Parameters
lines:Sequence[bytes]list of byte string lines from the diff to be parsed
Returns
tuple[list[bytes], list[bool], list[tuple[int, int]]]Undocumented
_GIT_ADDED_START: bytes =

Undocumented

Value
b'+'
_GIT_BINARY_START: bytes =

Undocumented

Value
b'Binary file'
_GIT_CHUNK_START: bytes =

Undocumented

Value
b'@@'
_GIT_DELETED_START: bytes =

Undocumented

Value
b'-'
_GIT_HEADER_START: bytes =

Undocumented

Value
b'diff --git a/'
_GIT_RENAMEFROM_START: bytes =

Undocumented

Value
b'rename from'
_GIT_RENAMETO_START: bytes =

Undocumented

Value
b'rename to'
_GIT_UNCHANGED_START: bytes =

Undocumented

Value
b' '
_git_header_name =

Undocumented