Patch
One file-level patch operation.
Patch values are returned by diff and yielded by
decode.
Fields
source @ fs.Path[get]Source path of the patch as a
Path.Present for delete, modify, move, and copy operations; reading it for a create raises
FieldError.Example
target @ fs.Path[get]Target path of the patch as a
Path.Present for create, modify, move, and copy operations; reading it for a delete raises
FieldError.Example
type @ (:CREATE: | :DELETE: | :MODIFY: | :MOVE: | :COPY:)[get]Operation kind as a symbol.
One of
:CREATE:,:DELETE:,:MODIFY:,:MOVE:, or:COPY:.Example
Methods
apply base -> (Str | Bin)
Applies the patch to base.
Parameters
| Name | Type | Description |
|---|---|---|
base |
(Str | Bin) |
Content to patch. Text content must still be valid UTF-8 once patched. |
Returns
The same type as base.
Errors
ApplyError if the patch does not apply cleanly, or a
text result is not valid UTF-8.