package patch
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Module PatchSource
Patch - parsing and applying unified diffs in pure OCaml
Source
type hunk = {mine_start : int;mine_len : int;mine : string list;their_start : int;their_len : int;their : string list;
}A hunk contains some difference between two files: each with a start line and length, and then the content as lists of string.
pp_hunk ppf hunk pretty-prints the hunk on ppf, the printing is in the same format as diff does.
pp_operation ppf op pretty-prints the operation op on ppf.
operation_eq a b is true if a and b are equal.
The type of a diff: an operation, a list of hunks, and information whether a trailing newline exists on the left and right.
pp ppf t pretty-prints t on ppf.
pp ppf diffs pretty-prints diffs on ppf.
patch file_contents diff applies diff on file_contents, resulting in the new file contents (or None if deleted).