Skip to main content

Module revspec

Module revspec 

Source
Expand description

Revision-spec resolution: map a revspec string to a session record id.

Supported forms (resolved over the Tier-1 journal DAG):

  • @head / HEAD / @ → the current HEAD record
  • @head~N / HEAD~N (N >= 0) → walk N parent links back from HEAD
  • @head^ / HEAD^ → parent of HEAD (same as ~1)
  • <seq> (a bare non-negative int) → the record with that seq
  • @time:<unix_ms> → the most recent record at or before that time
  • @latest:<label> → the highest-seq record whose op_kind OR label equals <label>
  • <id> or a unique <id-prefix> → the record whose id equals / uniquely begins with the text

Resolution is deterministic and never panics; ambiguity or no-match is an error.

Functions§

resolve_revspec
Resolve spec to a record id, given the full record list and the current HEAD (None if the session is empty). Returns an error if the spec is malformed, ambiguous, or matches no record.
resolve_revspec_for
Load the session for doc_id and resolve spec to a record id.