Skip to content

Commit

Permalink
Merge pull request #57 from samoht/master
Browse files Browse the repository at this point in the history
clean-up before the release
  • Loading branch information
samoht committed May 27, 2014
2 parents d9293c9 + e85435a commit aa0b51f
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 76 deletions.
58 changes: 38 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,46 @@ on top of Xen.

[![Build Status](https://travis-ci.org/mirage/irmin.png?branch=master)](https://travis-ci.org/mirage/irmin)

### Build & Install
### Install

You first need to have `libssl` on your system. For instance, on Debian/Ubuntu:
Irmin is packaged with [opam](https://opam.ocaml.org):

```
opam install irmin
```
apt-get install libssl-dev

### Usage

Irmin comes with a command-line tool called `irmin`. See `irmin
--help` for further reading. Use either `irmin <command> --help` or
`irmin help <command>` for more information on a specific command.

To get the full capabilites of Irmin, use the API:

```ocaml
$ ledit ocaml
# #require "irmin.backend";;
# module G = IrminGit.Make(IrminGit.Memory);;
# module S = G.Make(IrminKey.SHA1)(IrminContents.String)(IrminTag.String);;
# let () =
S.create () >>= fun t ->
S.update t ["foo"; "bar"] "hi!"
```

### Tutorial

A tutorial is available on the [wiki](https://github.com/mirage/irmin/wiki/Getting-Started).

### Issues

To report any issues please use the [bugtracker on Github](https://github.com/irmin/issues).

### Install from source

If you need to install Irmin from source, first you need to have
`libssl` on your system. For instance, on Debian/Ubuntu: ``` apt-get
install libssl-dev```.

Then, install the OCaml dependencies using [OPAM](http://opam.ocaml.org):
```
opam install ezjsonm ocamlgraph lwt sha \
Expand All @@ -33,25 +66,10 @@ make PREFIX=$(opam config var prefix)
make install
```

### Uninstall

Due to a bug in [oasis], the uninstall target is quite unreliable. Instead, use:
Due to a bug in [oasis], the uninstall target from source is quite
unreliable. Instead, use:

```
ocamlfind remove irmin
rm $(which irmin)
```

### Usage

Irmin comes with a command-line tool called `irmin`. See `irmin
--help` for further reading. Use either `irmin <command> --help` or
`irmin help <command>` for more information on a specific command.

### Tutorial

A tutorial is available on the [wiki](https://github.com/mirage/irmin/wiki/Getting-Started).

### Issues

To report any issues please use the [bugtracker on Github](https://github.com/irmin/issues).
55 changes: 0 additions & 55 deletions lib/backend/irminCRUD.ml
Original file line number Diff line number Diff line change
Expand Up @@ -169,61 +169,6 @@ module XMake (Client: Cohttp_lwt.Client) = struct

end

(*
module BC (U: Config) (K: Key) (C: IrminContents.S) (T: IrminTag.S) = struct
module RW = RW(U)(K)(C)
type t = Uri.t * T.t
type branch = T.t
let create ?branch t =
let branch = match branch with
| None -> T.master
| Some b -> b in
U.uri, branch
let branch (_, b) = b
let with_branch (t, _) b = (t, b)
let json_of_origin =
Ezjsonm.option IrminOrigin.to_json
let update t ?origin key value =
Log.debugf "update %s" (K.to_string key);
post t ["update"; K.to_string key]
(Ezjson.pair json_of_origin V.to_json (origin, value))
Ezjsonm.get_unit
let remove t ?origin key =
Log.debugf "remove %s" (K.to_string key);
post t ["remove"; K.to_string key] (json_of_origin origin) Ezjsonm.get_unit
let clone t branch =
Log.debugf "clone %s" (T.to_string branch);
post t ["clone"; T.to_string branch ] >>= fun () ->
with_branch t branch
let force_clone t branch =
Log.debugf "force_clone %s" (T.to_string branch);
post t ["force-clone"; T.to_string branch ] >>= fun () ->
with_branch t branch
let merge t ?origin branch =
Log.debugf "merge";
post t ["merge"; T.to_string branch]
(json_of_origin origin) (result_of_json Ezjsonm.get_unit)
let merge_exn t ?origin branch =
Log.debugf "merge";
post t ["merge"; T.to_string branch]
(json_of_origin origin) Ezjsonm.get_unit
end
*)

module Make (U: Config) (K: IrminKey.S) (B: IrminContents.S) (T: IrminTag.S) = struct

module N = IrminNode.S(K)
Expand Down
4 changes: 4 additions & 0 deletions lib/core/irminMerge.ml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ module Result (A: IrminIdent.S) = struct

end

module UnitResult = Result(IrminIdent.Make(struct
type t = unit with sexp,compare
end))

type 'a merge = old:'a -> 'a -> 'a -> 'a result

type 'a merge' = old:'a -> 'a -> 'a -> 'a result Lwt.t
Expand Down
5 changes: 4 additions & 1 deletion lib/core/irminMerge.mli
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,10 @@ type 'a result =
(** Merge results. *)

module Result (A: IrminIdent.S): IrminIdent.S with type t = A.t result
(** Base function over results. *)
(** Base function over [A.t result]s.. *)

module UnitResult: IrminIdent.S with type t = unit result
(** Base functions overs [unit result]s. *)

exception Conflict of string
(** Exception which might be raised when merging. *)
Expand Down
7 changes: 7 additions & 0 deletions lib/server/irminHTTP.ml
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ module Server (S: Irmin.S) = struct
output = IrminOrigin.to_json;
}

let result = {
input = IrminMerge.UnitResult.of_json;
output = IrminMerge.UnitResult.to_json;
}

let mk_dump key value =
list (pair key value)

Expand Down Expand Up @@ -311,6 +316,7 @@ module Server (S: Irmin.S) = struct
let store =
let s_update t p o c = S.update t ?origin:o p c in
let s_remove t p o = S.remove t ?origin:o p in
let s_merge t b o = S.merge t ?origin:o b in
Node [
mklp0bf "read" S.read t path (some contents);
mklp0bf "mem" S.mem t path bool;
Expand All @@ -319,6 +325,7 @@ module Server (S: Irmin.S) = struct
mklp1bf "remove" s_remove t path (some origin) unit;
mk0p0bf "dump" S.dump t (mk_dump path contents);
mklp0bs "watch" S.watch t path contents;
mklp1bf "merge" s_merge t tag (some origin) result;
"contents", contents_store;
"node" , node_store;
"commit" , commit_store;
Expand Down

0 comments on commit aa0b51f

Please sign in to comment.