LibraLibra
LibraLibra
DocsBlogLibra
Getting Started
Architecture
Design
Commands
libra addlibra agentlibra alternateslibra applylibra archivelibra authlibra automationlibra bisectlibra blamelibra branchlibra bundlelibra cachelibra cat-filelibra check-attrlibra check-ignorelibra check-mailmaplibra checkoutlibra cherry-picklibra cleanlibra clonelibra cloudlibra code-controllibra codelibra commit-treelibra commitlibra completionslibra configlibra credentiallibra depslibra describelibra diff-fileslibra diff-indexlibra diff-treelibra difflibra dirtylibra fast-exportlibra fast-importlibra fetchlibra filelibra for-each-reflibra format-patchlibra fscklibra gclibra graphlibra greplibra hash-objectlibra hookslibra hydratelibra index-packlibra initlibra investigatelibra layerlibra lfslibra loglibra logfilelibra loginlibra logoutlibra ls-fileslibra ls-remotelibra ls-treelibra maintenancelibra medialibra merge-baselibra merge-filelibra mergelibra metadatalibra mvlibra noteslibra oplibra openlibra pack-objectslibra packagelibra prunelibra publishlibra pulllibra pushlibra read-treelibra rebaselibra refloglibra remotelibra repacklibra replacelibra rererelibra resetlibra restorelibra rev-listlibra rev-parselibra revertlibra reviewlibra revisionlibra rmlibra sandboxlibra servicelibra shortloglibra show-reflibra showlibra sparse-viewlibra stashlibra statslibra statuslibra switchlibra symbolic-reflibra taglibra update-indexlibra update-reflibra usagelibra verify-packlibra whoamilibra worktreelibra write-tree
API Reference
Policy
Commands

libra revision

Command reference for `libra revision`

Revision ordinal index (a Libra extension, lore.md §1.16, porting Lore's revision find number). Git has no equivalent surface.

Synopsis

libra revision find --number <N> [--ref <branch>]
libra revision number <commitish> [--ref <branch>]
libra revision index [--ref <branch>] [--rebuild]

Description

Each branch's first-parent chain gets a monotonic 1-based numbering (1 = root, N = tip), stored in a rebuildable SQLite side table. The numbering is a pure function of the tip (deterministic across rebuilds and machines). Commits reachable only through merged-in side branches have no ordinal — the reverse lookup says so explicitly rather than inventing a number.

Freshness is re-validated on every read, in the same transaction as the lookup: fast-forwards append (existing ordinals never change); history rewrites (rebase/amend/reset) and refs/replace changes trigger a full deterministic rebuild. A stale index never answers. The first query on a long branch walks its whole chain once (O(chain) object loads, possibly remote under tiered storage); later queries are index hits.

SubcommandPurpose
find --number <N>Print the OID of revision #N (Lore's revision find number). Out of range → exit 1 naming the chain length; N < 1 → 129.
number <commitish>Reverse lookup: the ordinal of a commit on the ref's chain. Not on the chain → exit 1 with the coverage note.
index [--rebuild]Freshness report (tip, count, built-at); --rebuild forces a deterministic rebuild and prunes index rows for deleted branches.

--ref <branch> targets any local branch; the default is the current branch (detached HEAD → an error suggesting --ref). --json emits structured output. find --metadata (search by 1.10 revision metadata) is a documented follow-up — the ordinal index provides the deterministic iteration order such a scan would walk.

Exit codes

CodeMeaning
0Success.
1Miss (ordinal out of range; commit not on the chain).
128Fatal (not a repository; detached HEAD without --ref).
129Usage (--number < 1).

Examples

libra revision find -n 1                 # the root revision
libra revision number HEAD               # how long is the mainline?
libra revision find -n 42 --ref main     # the 42nd revision of main
libra revision index --rebuild           # deterministic rebuild + prune
libra --json revision number HEAD        # structured output

Comparison with Git

Nearest Git analogues: git rev-list --first-parent --count <oid> (reverse direction) and <tip>~<k> suffix arithmetic (forward). Classified intentionally-different in COMPATIBILITY.md.

libra review

Command reference for `libra review`

libra rm

Command reference for `libra rm`

On this page

SynopsisDescriptionExit codesExamplesComparison with Git