> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mesa.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# diffs.get()

> Inspect the diff between two changes.

Retrieve a structured diff between two Mesa change IDs.

**Required scope: `read`**

```python theme={null}
diff = await mesa.diffs.get(
    repo="app",
    base_change_id="zyxwvutsrqponmlkzyxwvutsrqponmlk",
    head_change_id="lmnopqrstuvwzyxklmnopqrstuvwzyxk",
)

print(diff.stats.additions, diff.stats.deletions)
```

Fetch only conflicted entries:

```python theme={null}
diff = await mesa.diffs.get(
    repo="app",
    base_change_id="zyxwvutsrqponmlkzyxwvutsrqponmlk",
    head_change_id="lmnopqrstuvwzyxklmnopqrstuvwzyxk",
    conflicts="only",
)
```

## Options

**repo** `str` *required*

Repository name.

**base\_change\_id** `str` *required*

Base Mesa change ID.

**head\_change\_id** `str` *required*

Head Mesa change ID.

**conflicts** `'include' | 'only' | 'exclude' | None`

Controls whether conflicted entries are included, excluded, or returned exclusively.

## Response

`entries[]` and `conflicted_entries[]` are mutually exclusive: unresolved conflicted paths appear only in `conflicted_entries[]`.

**base\_change\_id** `str`

Base change used for comparison.

**head\_change\_id** `str`

Head change used for comparison.

**stats** `DiffStats`

Aggregate counts for the response.

**truncated** `bool`

Whether the response hit the server entry limit and is incomplete.

**entries** `list[DiffEntry]`

Structural changed entries. Unchanged paths are omitted.

**conflicted\_entries** `list[ConflictedDiffEntry]`

Conflict-only details for unresolved paths.

### DiffStats

**entries** `int`

Number of structural entries returned in `entries[]`.

**additions** `int`

Total added lines across textual diff hunks.

**deletions** `int`

Total deleted lines across textual diff hunks.

**changes** `int`

Sum of `additions` and `deletions`.

**conflicted\_entries** `int`

Number of paths returned in `conflicted_entries[]`.

**conflicted\_hunks** `int`

Total conflict hunk count across `conflicted_entries[]`.

### DiffEntry

**path** `str`

Repository-relative path at the head change.

**status** `'added' | 'modified' | 'deleted' | 'renamed'`

How the entry changed between the base and head changes.

**old\_path** `str | None`

Previous repository-relative path for renamed entries. Null for non-renames.

**size\_bytes** `int | None`

Approximate size in bytes of the changed entry content, not the textual diff.

**is\_conflicted** `bool`

Always false for entries returned in `entries[]`. Conflicted paths are returned in `conflicted_entries[]`.

**omitted\_reason** `'binary' | 'too_large' | 'file_limit' | None`

Why textual hunk data is unavailable. Null when `hunks` is present.

**hunks** `list[DiffHunk] | None`

Structured textual diff hunks. Null when `omitted_reason` is set.

**conflict\_hunks** `list[DiffConflictHunk] | None`

Structured conflict hunks for the entry, or null when there are none. Structural entries in `entries[]` normally return null.

### DiffHunk

**old\_start** `int`

Starting line number in the base side.

**old\_lines** `int`

Number of base-side lines covered by the hunk.

**new\_start** `int`

Starting line number in the head side.

**new\_lines** `int`

Number of head-side lines covered by the hunk.

**lines** `list[DiffLine]`

Lines in this textual diff hunk.

### DiffLine

**kind** `'context' | 'added' | 'deleted' | 'annotation'`

Line classification inside a textual diff hunk.

**text** `str`

Line text.

### ConflictedDiffEntry

**path** `str`

Repository-relative path for the unresolved conflict.

**hunks** `list[DiffConflictHunk]`

Per-hunk conflict detail. Empty when `omitted_reason` is set or the conflict is non-textual.

**size\_bytes** `int | None`

Approximate size in bytes of the largest side of the conflict.

**omitted\_reason** `'binary' | 'too_large' | None`

Why hunk data is unavailable. When set, fetch file bytes with `mesa.content.get()` against the target or source change to compose a whole-file resolution.

### DiffConflictHunk

**hunk\_id** `str`

Stable identifier for the conflict hunk.

**old\_start** `int`

Starting line number in the base side.

**old\_lines** `int`

Number of base-side lines covered by the hunk.

**new\_start** `int`

Starting line number in the head side.

**new\_lines** `int`

Number of head-side lines covered by the hunk.

**target** `ChangeConflictHunkSide | None`

Target side of the conflicted hunk.

**base** `ChangeConflictHunkSide | None`

Base side of the conflicted hunk.

**source** `ChangeConflictHunkSide | None`

Source side of the conflicted hunk.

### ChangeConflictHunkSide

**content** `str`

Base64-encoded raw bytes for this side of the conflicted hunk.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.