Learn R Programming

automerge (version 0.3.1)

am_change_deps: Get the dependencies of a change

Description

Returns the hashes of the changes that this change depends on (i.e., its parent changes in the causal graph). The first change in a document has no dependencies.

Usage

am_change_deps(change)

Value

A list of raw vectors (change hashes), each 32 bytes. Returns an empty list for the first change in a document.

Arguments

change

An am_change object (from am_get_changes() or am_change_from_bytes())

Examples

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

history <- am_get_changes(doc)
deps1 <- am_change_deps(history[[1]])
deps1

deps2 <- am_change_deps(history[[2]])
deps2

am_close(doc)

Run the code above in your browser using DataLab