Expand description
Save-as over a container: a new one holding the source’s manifest up to a rev, line for line, and the rev files those rows name.
The user, dropping Restore for this: “a cleaner solution is to have a way to save a log up to a given rev as a new document. This allows you to time-machine back to an earlier rev and make clean edits on top of it.”
The rows are copied verbatim. The hash chain is over the bytes a file holds, so a save that re-serialized them would be a save that could break the chain that verifies it; copying a contiguous prefix keeps it whole by construction — every row still follows the one it named as its parent — and carries every column a re-serialization would have to invent: the wall times, the authors, the cameras, the edit/undo/redo kinds, the tag rows, and any field a later build adds.
What is left behind is everything after the cut, which is what the user asked for: the revs past it, and the names given to them.
Names given to revs inside the cut are kept whatever order they were written in — a rev tagged from the head, long after it was made, still arrives named. Those tag rows cannot be copied (their parent link names a row that is not here), so they are written again, by whoever asked for the save: a tag is a claim about history rather than part of it, so re-stating one is honest where re-stating an edit would not be.
Enums§
- Prefix
Failure - Why a document could not be saved as it stood at a rev.
Functions§
- carry_
assets 🔒 - Copy the artwork the carried revs reference from one container’s
assets/to another’s. Content-addressed, so the file’s name in the new container is the name it had in the old one and nothing has to be rewritten. - carry_
revs 🔒 - Copy the rev files at or below the cut, so the saved container arrives with the history it inherited already written.
- named_
through 🔒 - What the whole manifest calls the revs at or before
at— the names the saved container owes, wherever in the file they were written. A later row that clears a name is honoured like any other: the rev arrives unnamed, because that is what the source says it is called. - parse 🔒
- read_
manifest 🔒 - The source manifest, as text.
- rename_
revs 🔒 - Make the saved container call its revs what
wantedcalls them. - save_
through - Write the document as it stood at
atinto a new container atto, and open it. - through 🔒
- The leading run of
text’s lines that reaches no further thanat. - whole_
lines 🔒 - The manifest’s finished lines, numbered from one. A trailing line with no newline is left out, exactly as a load drops it: it is a row a crash caught half-written.