entryDiff
What a history entry changed, from the entry before it (its first parent: a merge's, what it brought); undefined
for the first entry. Its names, and its parent's, are made from the names read last (#7gy7o7lo).
import { diffNamespaces } from "#codebase/tcmts/cli/diff"; import type { NamespaceDiff } from "#codebase/tcmts/cli/diff"; import type { Share } from "#codebase/tcmts/share"; export function entryDiff(s: Pick<Share, "cb" | "cache">, hash: string): NamespaceDiff | undefined { const c = s.cb.store.causal(hash); if (!c?.parents.length) return undefined; const trees = s.cache.trees(s.cb); // (the entry's names first, then its parent's from them: the way a history is read, newest first) const after = trees.state(hash); const before = trees.state(c.parents[0]!); return diffNamespaces(before, after, (h) => trees.ir(h)); }