Module unified

Source
Expand description

Parsing of unified patches

Structs§

BinaryPatch
A binary patch
Hunk
A hunk in a patch
MalformedHunkHeader
An error that occurs when parsing a hunk header
MalformedLine
An error that occurs when parsing a hunk line
PatchConflict
Conflict applying a patch
UnifiedPatch
A unified diff style patch

Enums§

Error
Errors that can occur while parsing a patch
FileEntry
Parse a patch file
HunkLine
A line in a hunk
PlainOrBinaryPatch
A patch that can be applied to a single file

Constants§

NO_NL
The string that indicates that a line has no newline

Functions§

difference_index
Find the index of the first character that differs between two texts
get_patch_names
Get the names of the files in a patch
iter_exact_patched_from_hunks
Iterate through a series of lines with a patch applied.
iter_file_patch
Iterate through a series of lines.
iter_hunks
Iterate over the hunks in a patch
iter_lines_handle_nl
Iterate through a series of lines, ensuring that lines that originally had no terminating newline are produced without one.
parse_patch
Parse a patch file
parse_patches
Parse a patch file
parse_range
Parse a patch range, handling the “1” special-case
splitlines
Split lines but preserve trailing newlines