25 lines
745 B
OCaml
25 lines
745 B
OCaml
open Lwt.Infix
|
|
module F = Fmt
|
|
module S = Irmin_git_unix.FS.KV (Irmin.Contents.String)
|
|
module Sync = Irmin.Sync.Make (S)
|
|
|
|
type t = S.tree
|
|
type tree = t
|
|
type step = S.step
|
|
type path = step list
|
|
|
|
let init () = S.Repo.v (Irmin_mem.config ()) >>= S.main >>= S.tree
|
|
let info = Irmin_git_unix.info
|
|
|
|
let test_populate () : t Lwt.t =
|
|
let add p s t = S.Tree.add t p s in
|
|
add [ "hello" ] "world" (S.Tree.empty ())
|
|
>>= add [ "hello"; "daddy" ] "ily"
|
|
>>= add [ "beep"; "beep" ] "motherfucker"
|
|
|
|
let init_default upstream_url : Sync.db Lwt.t =
|
|
S.Repo.v (Irmin_git.Conf.init "../rootstore") >>= fun repo ->
|
|
S.of_branch repo "lablgtk" >>= fun t ->
|
|
S.remote upstream_url >>= fun upstream ->
|
|
Sync.pull_exn t upstream `Set >>= fun _ -> Lwt.return t
|