selectCommitDiff(
args: {after:string;before:string;hints?: {entityIds?:string[];fileId?:string;includeUnchanged?:boolean;pluginKey?:string;schemaKeys?:string[]; };lix:Lix; }):SelectQueryBuilder<any,"diff",DiffRow>
Compare two commits and return differences between their leaf entity states.
Reconstructs entity states at each commit by walking commit ancestry, then compares them. Unlike version-based diffs, this dynamically computes states without requiring version materialization.
Diff status meanings:
added: Entity exists only in after commitremoved: Entity exists only in before commitmodified: Entity exists in both with different change_idsunchanged: Entity exists in both with same change_idUses fast-path optimization when includeUnchanged: false (default) by first identifying
changed entity triples, then only reconstructing leaf states for those.
The hints parameter filters results at the database level for better performance:
includeUnchanged: Include unchanged entities (default: true). Set false for fast-path optimization.fileId: Limit to specific filepluginKey: Filter by plugin that created changesschemaKeys: Include only specific entity typesentityIds: Include only specific entities// Get changes between commits
const changes = await selectCommitDiff({
lix,
before: 'abc123',
after: 'xyz789',
hints: { includeUnchanged: false }
}).execute();// Filter by file and status
const fileDiff = await selectCommitDiff({ lix, before, after })
.where('diff.file_id', '=', 'messages.json')
.where('diff.status', '!=', 'unchanged')
.execute();| Parameter | Type |
|---|---|
args | { after: string; before: string; hints?: { entityIds?: string[]; fileId?: string; includeUnchanged?: boolean; pluginKey?: string; schemaKeys?: string[]; }; lix: Lix; } |
args.after | string |
args.before | string |
args.hints? | { entityIds?: string[]; fileId?: string; includeUnchanged?: boolean; pluginKey?: string; schemaKeys?: string[]; } |
args.hints.entityIds? | string[] |
args.hints.fileId? | string |
args.hints.includeUnchanged? | boolean |
args.hints.pluginKey? | string |
args.hints.schemaKeys? | string[] |
args.lix | Lix |
SelectQueryBuilder<any, "diff", DiffRow>