am_get_change_by_hash: Get a specific change by its hash

View source: R/document.R

am_get_change_by_hashR Documentation

Get a specific change by its hash

Description

Retrieves a change from the document's history by its unique hash identifier. The hash is typically obtained from am_get_heads() or am_get_changes().

Usage

am_get_change_by_hash(doc, hash)

Arguments

doc

An Automerge document

hash

A raw vector containing the change hash (must be exactly 32 bytes)

Value

A raw vector containing the serialized change, or NULL if the change hash is not found in the document.

Examples

doc <- am_create()
doc$key <- "value"
am_commit(doc, "Add key")

# Get the current heads (change hashes)
heads <- am_get_heads(doc)
head_hash <- heads[[1]]

# Retrieve the change by its hash
change <- am_get_change_by_hash(doc, head_hash)
str(change)  # Raw vector

am_close(doc)


automerge documentation built on Feb. 5, 2026, 5:08 p.m.