Skip to content

apply_repository_export_delta

Function: warmhub.apply_repository_export_delta

apply_repository_export_delta(base: Iterable[RepositoryExportRow], delta: Iterable[RepositoryExportRow], *, base_format_version: int, delta_format_version: int)

Fold a delta export over a base, keyed by durable identity.

Pure and order-preserving: rows already present keep their position, new rows land at the end, and tombstones drop their identity. Durable identity is the key rather than wref because a rename changes the wref and this fold must survive one.

From format 6 a Shape row is keyed by (durableId, version): a delta that revises a Shape keeps every earlier version decodable, and a Shape tombstone (the Shape was removed) drops every version of it. Pass each side’s header.format_version. A format-6 delta onto a format-5 base (or the reverse) raises format_mismatch: take one fresh full export instead.