Skip to content

Range diff

range_diff

Read-only delivered commit-range tool.

RangeDiffTool

Bases: AXMTool

Measure changed files and hunks for a commit range.

Source code in packages/axm-git/src/axm_git/tools/range_diff.py
Python
class RangeDiffTool(AXMTool):
    """Measure changed files and hunks for a commit range."""

    @property
    def name(self) -> str:
        return "git_range_diff"

    def execute(
        self, path: str = ".", base: str = "", head: str = "", **kwargs: object
    ) -> ToolResult:
        """Return a pinned commit-range footprint, without writing to the repo."""
        try:
            root = Path(path)
            base, head = resolve_revision(root, base), resolve_revision(root, head)
            files = range_diff(root, base, head)
        except (ValueError, OSError) as exc:
            return ToolResult(success=False, error=str(exc))
        data = {"base": base, "head": head, "files": [asdict(file) for file in files]}
        return ToolResult(success=True, data=data, text=str(data))
execute(path='.', base='', head='', **kwargs)

Return a pinned commit-range footprint, without writing to the repo.

Source code in packages/axm-git/src/axm_git/tools/range_diff.py
Python
def execute(
    self, path: str = ".", base: str = "", head: str = "", **kwargs: object
) -> ToolResult:
    """Return a pinned commit-range footprint, without writing to the repo."""
    try:
        root = Path(path)
        base, head = resolve_revision(root, base), resolve_revision(root, head)
        files = range_diff(root, base, head)
    except (ValueError, OSError) as exc:
        return ToolResult(success=False, error=str(exc))
    data = {"base": base, "head": head, "files": [asdict(file) for file in files]}
    return ToolResult(success=True, data=data, text=str(data))