Artifact 486f59013b564f79c7977acf5728af170c04fb0f52dfb5fdc461d5db3faff09c:
- File
cli/repo_info.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: 1108) [annotate] [blame] [check-ins using]
package cli import "fmt" // RepoInfoCmd shows repository statistics. type RepoInfoCmd struct{} func (c *RepoInfoCmd) Run(g *Globals) error { r, err := g.OpenRepo() if err != nil { return err } defer r.Close() db := r.Inner().DB() var blobCount, deltaCount, phantomCount int var totalSize int64 var projectCode, serverCode string db.QueryRow("SELECT count(*) FROM blob WHERE size >= 0").Scan(&blobCount) db.QueryRow("SELECT count(*) FROM delta").Scan(&deltaCount) db.QueryRow("SELECT count(*) FROM phantom").Scan(&phantomCount) db.QueryRow("SELECT coalesce(sum(size),0) FROM blob WHERE size >= 0").Scan(&totalSize) db.QueryRow("SELECT value FROM config WHERE name='project-code'").Scan(&projectCode) db.QueryRow("SELECT value FROM config WHERE name='server-code'").Scan(&serverCode) fmt.Printf("project-code: %s\n", projectCode) fmt.Printf("server-code: %s\n", serverCode) fmt.Printf("blobs: %d\n", blobCount) fmt.Printf("deltas: %d\n", deltaCount) fmt.Printf("phantoms: %d\n", phantomCount) fmt.Printf("total size: %d bytes\n", totalSize) return nil }