Qu

read_version

Builtin index · File I/O

read_version(path, version)

Input: path, version · Output: no output

What it is

The content of one saved version of path as a Str. version is an id from file_history or a position: 1 is the most recent, 2 the one before.

Overloads

One call shape — this function is not overloaded.

CodeInputOutputDescription
read_version(path, version)
path StrThe content of one saved version of path as a Str.
version —version is an id from file_history or a position: 1 is the most recent, 2 the one before.
not documented yet—

Examples

From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.

file_versioning(true)
write_text("notes.txt", "first draft")
write_text("notes.txt", "second draft")    # "first draft" is kept

print(file_history("notes.txt"))
print(read_version("notes.txt", 1))        # first draft

restore_version("notes.txt", 1)            # back to the first draft

not run by the build — this one needs something the repository cannot supply · from file-io