Artifact ee5ab7354c20e9e43f7e002a3e76981afd348e274b37e3a536f4776d841c2b8f:
- File
repo.go
— part of check-in
[f5744359d3]
at
2026-04-19 16:30:54
on branch trunk
— Initial open source release
libfossil is a pure-Go implementation of the Fossil SCM, reading and writing the same .fossil SQLite repository format as upstream Fossil.
This is the first public release of code that previously lived in a private repository. The module path is github.com/danmestas/libfossil and the binary is named libfossil to avoid $PATH collisions with upstream fossil.
Included: - Repo lifecycle (create, clone), checkout/checkin, timeline, merge, diff, annotate, shun, tag, branch, bisect, stash, undo/redo - Sync-over-HTTP protocol (client and handler) - Two SQLite drivers: modernc (pure Go, default) and ncruces (wasm-capable) - Observer interfaces (SyncObserver, CheckoutObserver) with an optional OpenTelemetry implementation in observer/otel (separate submodule) - Deterministic simulation testing harness with BUGGIFY fault injection - Kong-based embeddable CLI under cli/ and a standalone binary under cmd/libfossil/ (user: [email protected], size: 1189) [annotate] [blame] [check-ins using]
package libfossil import ( "github.com/danmestas/libfossil/db" "github.com/danmestas/libfossil/internal/repo" ) // Repo is an opaque handle to a Fossil repository. type Repo struct { inner *repo.Repo path string } // Path returns the filesystem path to the repository file. func (r *Repo) Path() string { return r.path } // Inner returns the underlying internal repo handle. // This is exported for use by in-module packages (e.g., cli/) that need // direct access to the repo DB for raw SQL or internal package calls. func (r *Repo) Inner() *repo.Repo { return r.inner } // Close closes the repository and releases resources. func (r *Repo) Close() error { if r.inner == nil { return nil } return r.inner.Close() } // DB returns the underlying database handle for raw SQL queries. // Use this when the high-level Repo methods don't cover your use case. func (r *Repo) DB() *db.DB { return r.inner.DB() } // WithTx executes fn within a database transaction. func (r *Repo) WithTx(fn func(tx *db.Tx) error) error { return r.inner.WithTx(fn) } // Verify checks repository integrity (blob checksums, delta chains). func (r *Repo) Verify() error { return r.inner.Verify() }