Skip to main content
Retrieve a structured diff between two Mesa change IDs. Required scope: read
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:
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.
org
str | None
Organization override.

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.