Artifact 0038063a724dd61da383b46664856999f70e2f4a4150dc5d05f8d2f77684896a:
- File
src/repostate.zig
— part of check-in
[0ae7fb2622]
at
2026-07-08 21:53:01
on branch trunk
— Scaffold zit: Zig project + RFC references + module layout
Fossil-in-Zig, ported from the four RFC drafts (docs/rfcs/). Layout mirrors the RFC layering: delta -> artifact -> repostate -> sync. delta int codec + checksum and artifact naming/Z-card implemented with RFC-derived test vectors; everything else stubbed against its section. Builds clean; zig build test green. See docs/HANDOFF.md. (user: dmestas, size: 1519) [annotate] [blame] [check-ins using]
//! Repository State — draft-fossil-repo-state-00. //! //! Repository state is derived, not stored: branches, tags, leaves, closed //! markers, and the current-trunk check-in are computed from the crosslinked //! set of artifacts. This module owns that derivation over the parent DAG and //! the tag records defined by the Artifact Format. const std = @import("std"); const artifact = @import("artifact.zig"); /// A stored artifact's local integer identifier (Section 2). Local to a /// repository; not part of the artifact model and not synchronised. pub const Rid = u64; pub const Error = error{ Ambiguous, NotFound, NotImplemented }; /// Resolve a symbolic name (a branch name, tag, or `trunk`) to a single /// check-in. Resolution is a pure max-`mtime` selection among the check-ins /// carrying the active `sym-<name>` tag (Section 8); open/closed state and /// leaf-ness are NOT inputs. Exact-`mtime` ties are implementation-defined. pub fn resolveName(rid_out: *Rid, name: []const u8) Error!void { _ = rid_out; _ = name; return Error.NotImplemented; } /// The current-trunk check-in. NOTE: not a pure function of the artifact set — /// the branch name comes from the local `main-branch` setting (default /// "trunk"), then resolves by max-`mtime` (Section 9). pub fn currentTrunk(rid_out: *Rid, main_branch: []const u8) Error!void { _ = rid_out; _ = main_branch; return Error.NotImplemented; } test "repostate module compiles" { try std.testing.expect(@sizeOf(Rid) == 8); }