2017-08-27

(sph filesystem versioning)

gives a path to the next version of a file and automatically archives the old version.

part of sph-lib

default config

(define versioning-default-config
  (symbol-hashtable
    max-count 3 max-size (inf) path-versions "versions/" path-temp "temp/"))

library description

optionally depends on the "diff" and "patch" utilities for storing incremental changes.

# features

restore old versions

can use diff/patch files for previous versions for text files

limit the number of past versions to keep

size limit option to exclude big files from creating multiple versions

version identifiers are monotonically increasing integers in hexadecimal

import name

(sph filesystem versioning)

exports

sph-filesystem-versioning-description

variable

versioning-create

procedure

signature

type path proc config ->

symbol:text/binary string procedure:{string ->} -> integer:current-version-id

description

calls "proc" with a path to an empty file which is the next version, and moves the old file to

the directory for previous versions which is set in "config".

if type is the symbol "text", then only the differences are stored in the previous version

versioning-default-config

variable

versioning-restore

procedure

signature

type path version-id config ->

symbol:text/binary string integer -> string

description

result in a path to a file which is "path" at version "version-id".

the result path is not necessarily a copy


tags: programming guile documentation library scheme sph-lib q1 versioning filesystem highlight sph-filesystem-versioning