Skip to main content

restore_paths

Function restore_paths 

pub fn restore_paths(
    doc: &mut AutoCommit,
    target_heads: &[ChangeHash],
    paths: &[String],
) -> Result<usize, String>
Expand description

Restore only the exact paths listed by changed_items, writing forward through the same patch machinery as restore. A root path selects its entire value (including every descendant); map/id selects only that entry. Unlike restore, an empty selection never means the whole document.

Legacy history paths are not escaped. This API therefore refuses components containing / or ~, and refuses ambiguous legacy paths rather than guessing. Bookkeeping cannot be selected. All paths must name differing items in this comparison; invalid selections are rejected together before any patch writes. Duplicate paths are harmless. Returns the number of patches written, not items. The caller owns the open transaction and its attribution/commit, as for restore.

ยงErrors

Refuses empty/oversized selections, unknown heads, invalid, ambiguous or unchanged paths, entries whose collection was replaced (select the listed whole root instead), and comparisons with no applicable patches.