Skip to content

Returns the current "heads" of the document - the hashes of the most recent changes. These identify the current state of the document and can be used for history operations.

Usage

am_get_heads(doc)

Arguments

doc

An Automerge document

Value

A list of raw vectors, each containing a change hash. Usually there is only one head, but after concurrent edits there may be multiple heads until they are merged by a subsequent commit.

Examples

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

heads <- am_get_heads(doc)
heads
#> [[1]]
#>  [1] cf d7 9c b2 1e 5e 4b 7a c7 3b 05 b3 bd c4 bc 11 dc 30 10 9f 03 b5
#> [23] ce 41 88 7f 95 08 46 a5 be b3
#> 

am_close(doc)