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 diffs_to_components : t list -> Conex_utils.S.t * Conex_utils.S.t * Conex_utils.S.t * Conex_utils.S.t Conex_utils.M.t

diffs_to_components diffs categorises the diffs into sets of modified ids, authorisations, package resources, and a map of releases.

val patch : string option -> t -> string

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

OCaml

Innovation. Community. Security.