unchangedSince
uses tcmts.share.NameTrees, which uses tcmts.store.unpacked, which uses node:zlib
Whether nothing under namespace (a name or a file in it, or under it) changed between the history entry causal
and the branch's head: its node of the name tree, hashed by its content, is the same in both.
import type { Codebase } from "#codebase/tcmts/cli/codebase"; import { NameTrees } from "#codebase/tcmts/share"; export function unchangedSince(cb: Codebase, causal: string, namespace: string): boolean { const trees = new NameTrees(cb.store); const nodeAt = (c: string | undefined) => { let h = c ? cb.store.causal(c)?.namespace : undefined; for (const part of namespace ? namespace.split(".") : []) { if (h === undefined) return undefined; h = trees.node(h).children.get(part); } return h; }; try { const then = nodeAt(causal); return then !== undefined && then === nodeAt(cb.store.head()); } catch { // (history this codebase doesn't hold all of: not known to be unchanged) return false; } }