Module OpamPatch

val translate_patch : dir:string -> string -> string -> unit

translate_patch ~dir input_patch output_patch writes a copy of input_patch to output_patch as though input_patch had been applied in dir. The patch is rewritten such that if text files have different line endings then the patch is transformed to patch using the encoding on disk. In particular, this means that patches generated against Unix checkouts of Git sources will correctly apply to Windows checkouts of the same sources.

module type FS_ABSTR = sig ... end
val patch : (module FS_ABSTR with type root = 'a) -> allow_unclean:bool -> [ `Patch_file of string | `Patch_diffs of Patch.t list ] -> 'a -> (Patch.operation list, exn) Stdlib.result

patch FS_ABSTR ~allow_unclean ?patch_filename ~dir diffs applies a patch to given element by FS_ABSTRACTION.

  • parameter FS_ABSTR

    is a module that defines the element that we are patching and define all needed functions

  • parameter ~allow_unclean

    decides if applying a patch on a directory which differs slightly from the one described in the patch file is allowed. Allowing unclean applications imitates the default behaviour of GNU Patch.

val parse_patch : translate:string option -> string -> Patch.t list

parse_patch ~translate patch_file processes and parses a patch file. Returns the parsed patch diffs or raises Not_found if the patch file doesn't exist or can't be parsed.

  • parameter translate

    if Some dir, launch

    anslate_patch

}

on dir. Otherwise, no translation done.