Learn R Programming

automerge (version 0.3.0)

am_get_changes: Get changes since specified heads

Description

Returns all changes that have been made to the document since the specified heads. If heads is NULL, returns all changes in the document's history.

Usage

am_get_changes(doc, heads = NULL)

Value

A list of am_change objects.

Arguments

doc

An Automerge document

heads

A list of raw vectors (change hashes) returned by am_get_heads(), or NULL to get all changes.

Details

Changes are returned as am_change objects that can be inspected with am_change_hash(), am_change_message(), etc., serialized with am_change_to_bytes(), or applied to other documents using am_apply_changes().

Examples

Run this code
doc <- am_create()
am_put(doc, AM_ROOT, "x", 1)
am_commit(doc)

# Get all changes
all_changes <- am_get_changes(doc, NULL)
cat("Document has", length(all_changes), "change(s)\n")

am_close(doc)

Run the code above in your browser using DataLab