Skip to contents

Ignores no-op pushes whose semantic diff against the current snapshot is empty. Truncates any redo branch above the current pointer and trims oldest entries if the stack exceeds max_entries.

Usage

history_push(hist, spec, label = NULL)

Arguments

hist

A spec_history object created by spec_history().

spec

A validated spec_ir object.

label

Optional character description of the edit (defaults to format_diff_summary()).

Value

Invisibly returns the spec_diff relative to the previous snapshot.

Examples

h <- spec_history(new_spec_ir())
s2 <- new_spec_ir(hierarchy = list(levels = 1L, n_obs = 300L))
history_push(h, s2, label = "N = 300")
history_summary(h)
#>   index is_current                 label n_changes
#> 1     1      FALSE Initial specification         0
#> 2     2       TRUE               N = 300         1