package conex

  1. Overview
  2. Docs

Diff: decode patch files into hunks.

type hunk

A hunk.

type t = {
  1. mine_name : string;
  2. their_name : string;
  3. hunks : hunk list;
}

A diff is a list of hunks, and a filename (mine and their are different for file addition and removal, otherwise they should be equal.

val file : t -> string

file diff is mine_name unless this is "/dev/null", in which case their_name is used. A potentially leading "a/" or "b/" is stripped from mine/their.

val to_diffs : string -> t list

to_diffs str decodes the given patch into a list of diff.

val ids : string -> Conex_utils.path -> t list -> (bool * Conex_utils.S.t, string) result

ids rootname keydir diffs returns whether the root file was changed, and the set of modified ids.

val patch : string option -> t -> string

patch data diff is data', which is the result of applying diff to data.

OCaml

Innovation. Community. Security.