PublicShow -- Single-file GIT like version system

This library provides a first implementation of a lightweight versioned file store with dynamic meta-data. The store is partly modelled after GIT. Like GIT, it uses a content-based store. In fact, the stored objects are compatible with GIT. Unlike GIT though, there are no trees. Each entry (file) has its own history. Each commit is associated with a dict that can carry aribitrary meta-data. The following fields are reserved for gitties bookkeeping:

Name of the entry (file)
Float representing when the object was added to the store
Object hash of the contents
Hash of the previous commit.

The key commit is reserved and returned as part of the meta-data of the newly created (gitty_create/5) or updated object (gitty_update/5).

Source gitty_open(+Store, +Options) is det
Open a gitty store according to Options. Defined options are:
Backend driver to use. One of files or bdb. When omitted and the store exists, the current store is examined. If the store does not exist, the default is files.
Source gitty_driver(+Store, -Driver)
Get the current gitty driver
Source gitty_close(+Store) is det
Close access to the Store.
Source gitty_file(+Store, ?Head, ?Hash) is nondet
Source gitty_file(+Store, ?Head, ?Ext, ?Hash) is nondet
True when Hash is an entry in the gitty Store and Head is the HEAD revision.
Source gitty_create(+Store, +Name, +Data, +Meta, -Commit) is det
Create a new object Name from Data and meta information.
Commit- is a dit describing the new Commit
Source gitty_update(+Store, +Name, +Data, +Meta, -Commit) is det
Update document Name using Data and the given meta information
Source gitty_data(+Store, +NameOrHash, -Data, -Meta) is semidet
Get the data in object Name and its meta-data
Source gitty_commit(+Store, +NameOrHash, -Meta) is semidet
True if Meta holds the commit data of NameOrHash. A key commit is added to the meta-data to specify the commit hash.
Source gitty_history(+Store, +NameOrHash, -History, +Options) is det
History is a dict holding a key history with a list of dicts representating the history of Name in Store. The toplevel dict also contains skipped, indicating the number of skipped items from the HEAD. Options:
Number of entries in the history. If not present, defaults to 5.
Ensure Hash is included in the history. This means that the history includes the entry with HASH an (depth+1)//2 entries after the requested HASH.
Source gitty_fsck(+Store) is det
Check the integrity of store.
Source fsck_object(+Store, +Hash) is semidet
Test the integrity of object Hash in Store.
Source gitty_save(+Store, +Data, +Type, -Hash) is det
Source gitty_load(+Store, +Hash, -Data, -Type) is det
Low level objects store. These predicate allows for using the store as an arbitrary content store.
Data- is a string
Type- is an atom denoting the object type.
Source gitty_hash(+Store, ?Hash) is nondet
True when Hash is an object in the store.
Source delete_object(+Store, +Hash)
Delete an existing object
Source gitty_reserved_meta(?Key) is nondet
True when Key is a gitty reserved key for the commit meta-data
Source is_gitty_hash(@Term) is semidet
True if Term is a possible gitty (SHA1) hash
Source delete_head(+Store, +Head) is det
Delete Head from the administration. Used if the head is inconsistent.
Source set_head(+Store, +File, +Head) is det
Register Head as the Head hash for File, removing possible old head.
Source gitty_diff(+Store, ?Hash1, +FileOrHash2OrData, -Dict) is det
True if Dict representeds the changes in Hash1 to FileOrHash2. If Hash1 is unbound, it is unified with the previous of FileOrHash2. Returns _{initial:true} if Hash1 is unbound and FileOrHash2 is the initial commit. Dict contains:
Meta-data for the two diffed versions
String holding unified diff representation of changes to the data. Only present of data has changed
tags:_156198{added:AddedTags, deleted:DeletedTags}
If tags have changed, the added and deleted ones.
FileOrHash2OrData- is a file name, hash or a term data(String) to compare a given string with a gitty version.
Source data_diff(+Data1, +Data2, -UDiff) is det
Diff two data strings line-by-line. UDiff is a list of terms of the form below, where L1 and L2 provide the starting line in Data1 and Data2 and S1 and S2 provide the number of affected lines.

Diff is a list holding

+ Line
Line was added to Data1 to get Data2
- Line
Line was deleted from Data1 to get Data2
Line1 - Line2
Line was replaced
Line is identical (context line).
Source udiff_string(+UDiff, -String) is det
True when String is the string representation of UDiff.