package patdiff

  1. Overview
  2. Docs
File Diff using the Patience Diff algorithm

Install

Dune Dependency

Authors

Maintainers

Sources

v0.16.1.tar.gz
md5=ed1fd8166e2e99774432c1e28515f37e
sha512=7833f95ce42eeb17ecbef514eab13a37a0ab125b3c6e7e8af09c5b0efa3be6b971c6c4a40f3d809f1c254c8bc720ddaa46b54ff0514ddb9db0f5be03d99f5fd0

doc/src/patdiff.kernel/patdiff_core_intf.ml.html

Source file patdiff_core_intf.ml

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
open! Core
open! Import

module type S = sig
  (** [diff ~context ~keep_ws ~prev ~next] uses [Patience_diff.String] to get a list of
      hunks describing the comparison between [prev] and [next]. *)
  val diff
    :  context:int
    -> line_big_enough:int
    -> keep_ws:bool
    -> prev:string array
    -> next:string array
    -> Hunks.t

  (** [refine hunks] maps each [Range.Replace (prev, next)] in [hunks] to a diff of [prev]
      against [next]. *)
  val refine
    :  rules:Format.Rules.t
    -> produce_unified_lines:bool
    -> output:Output.t
    -> keep_ws:bool
    -> split_long_lines:bool
    -> interleave:bool
    -> word_big_enough:int
    -> Hunks.t
    -> Hunks.t

  val explode
    :  string array
    -> keep_ws:bool
    -> [ `Newline of int * string option | `Word of string ] array

  (** Print a hunk list, usually from [diff] or [refine] *)
  val print
    :  file_names:File_name.t * File_name.t
    -> rules:Format.Rules.t
    -> output:Output.t
    -> location_style:Format.Location_style.t
    -> Hunks.t
    -> unit

  (** Output a hunk list, usually from [diff] or [refine], to a string *)
  val output_to_string
    :  ?print_global_header:bool
    -> file_names:File_name.t * File_name.t
    -> rules:Format.Rules.t
    -> output:Output.t
    -> location_style:Format.Location_style.t
    -> Hunks.t
    -> string

  (** Iter along the lines of the diff and the breaks between hunks. Offers more flexibility
      regarding what the caller wants to do with the lines *)
  val iter_ansi
    :  rules:Format.Rules.t
    -> f_hunk_break:(int * int -> int * int -> unit)
    -> f_line:(string -> unit)
    -> Hunks.t
    -> unit


  (** Runs the equivalent of the command line version of patdiff on two given contents
      [prev] and [next].  Uses [Patience_diff.String]. *)
  val patdiff
    :  ?context:int
    -> ?keep_ws:bool
    -> ?rules:Format.Rules.t
    -> ?output:Output.t
    -> ?produce_unified_lines:bool
    -> ?split_long_lines:bool
    -> ?print_global_header:bool
    -> ?location_style:Format.Location_style.t
    -> ?interleave:bool
    -> ?line_big_enough:int
    -> ?word_big_enough:int
    -> prev:Diff_input.t
    -> next:Diff_input.t
    -> unit
    -> string
end

module type Output_impls = sig
  val implementation : Output.t -> (module Output.S)
  val console_width : unit -> int Or_error.t
end

module type Patdiff_core = sig
  module type S = S

  val default_context : int
  val default_line_big_enough : int
  val default_word_big_enough : int

  (** [remove_ws] calls String.strip and replaces whitespace with " " *)
  val remove_ws : string -> string

  module Private : sig
    module Make (Output_impls : Output_impls) : S
  end

  module Without_unix : S
end
OCaml

Innovation. Community. Security.