| 1 |
(**************************************************************************) |
| 2 |
(* *) |
| 3 |
(* Copyright 2016-2019 OCamlPro *) |
| 4 |
(* *) |
| 5 |
(* All rights reserved. This file is distributed under the terms of the *) |
| 6 |
(* GNU Lesser General Public License version 2.1, with the special *) |
| 7 |
(* exception on linking described in the file LICENSE. *) |
| 8 |
(* *) |
| 9 |
(**************************************************************************) |
| 10 |
|
| 11 |
(** uniquely identifies a filesystem item value *) |
| 12 |
type digest |
| 13 |
|
| 14 |
(** Defines a change concerning a fs item; The [digest] parameter is the new |
| 15 |
value of the item *) |
| 16 |
type change = |
| 17 |
| Added of digest |
| 18 |
| Removed |
| 19 |
| Contents_changed of digest |
| 20 |
(** For links, corresponds to a change of target *) |
| 21 |
| Perm_changed of digest |
| 22 |
| Kind_changed of digest |
| 23 |
(** Used e.g. when a file is replaced by a directory, a link |
| 24 |
or a fifo *) |
| 25 |
|
| 26 |
type t = change OpamStd.String.Map.t |
| 27 |
|
| 28 |
(** Returns a printable, multi-line string *) |
| 29 |
val to_string: t -> string |
| 30 |
|
| 31 |
(** Returns a summary of the changes as a printable, single-line string *) |
| 32 |
val to_summary_string: t -> string |
| 33 |
|
| 34 |
val digest_of_string: string -> digest |
| 35 |
val string_of_digest: digest -> string |
| 36 |
|
| 37 |
(** Return the [change] action, with digest if [full] is set to true *) |
| 38 |
val string_of_change: ?full:bool -> change -> string |
| 39 |
|
| 40 |
(** Removes the added and kind-changed items unless their contents changed and |
| 41 |
[force] isn't set, and prints warnings for other changes unless [verbose] is |
| 42 |
set to [false]. Ignores non-existing files. |
| 43 |
[title] is used to prefix messages if specified. *) |
| 44 |
val revert: |
| 45 |
?title:string -> ?verbose:bool -> ?force:bool -> ?dryrun:bool -> |
| 46 |
OpamFilename.Dir.t -> t -> unit |
| 47 |
|
| 48 |
(** Checks the items that were added or kind-changed in the given diff, and |
| 49 |
returns their status *) |
| 50 |
val check: |
| 51 |
OpamFilename.Dir.t -> t -> |
| 52 |
(OpamFilename.t * [`Unchanged | `Removed | `Changed]) list |
| 53 |
|
| 54 |
(** Reload all the digests from the directory [prefix]. Remove a file |
| 55 |
from the map if it has been removed from the file-system. *) |
| 56 |
val update : OpamFilename.Dir.t -> t -> t |