Artifact 5a15271fd422bf4d3ab33b1e5a33e0cd670a4aa91291a282c6e9de9c966ae854:
- File
cli/repo_merge_resolve.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: 1260) [annotate] [blame] [check-ins using]
package cli import ( "fmt" "os" "path/filepath" ) // RepoMergeResolveCmd marks a file conflict as resolved. type RepoMergeResolveCmd struct { File string `arg:"" help:"File to mark as resolved"` Dir string `short:"d" help:"Checkout directory" default:"."` } func (c *RepoMergeResolveCmd) Run(g *Globals) error { resolved := false // Try standard conflict: reset vfile.chnged from 5 to 1. ckout, err := openCheckout(c.Dir) if err == nil { defer ckout.Close() vid, _ := checkoutVid(ckout) result, err := ckout.Exec("UPDATE vfile SET chnged=1 WHERE pathname=? AND vid=? AND chnged=5", c.File, vid) if err == nil { affected, _ := result.RowsAffected() if affected > 0 { base := filepath.Join(c.Dir, c.File) os.Remove(base + ".LOCAL") os.Remove(base + ".BASELINE") os.Remove(base + ".MERGE") fmt.Printf("resolved: %s (conflict markers)\n", c.File) resolved = true } } } // Try conflict-fork: delete from conflict table. r, err := g.OpenRepo() if err == nil { defer r.Close() err := r.ResolveConflictFork(c.File) if err == nil { fmt.Printf("resolved: %s (conflict-fork)\n", c.File) resolved = true } } if !resolved { return fmt.Errorf("%s: no conflict found", c.File) } return nil }