ddmp.patch

Undocumented in source.

Members

Functions

addContext
void addContext(Patch patch, string text)

Increase the context until it is unique, but don't let the pattern expand beyond Match_MaxBits. @param patch The patch to grow. @param text Source text.

addPadding
string addPadding(Patch[] patches)

Add some padding on text start and end so that edges can match something. Intended to be called only from within patch_apply. @param patches Array of Patch objects. @return The padding string added to each side.

apply
PatchApplyResult apply(Patch[] patches, string text)
Undocumented in source. Be warned that the author may not have intended to support it.
patch_fromText
Patch[] patch_fromText(string textline)

Parse a textual representation of patches and return a List of Patch objects. @param textline Text representation of patches. @return List of Patch objects. @throws ArgumentException If invalid input.

patch_make
Patch[] patch_make(string text1, string text2)

Compute a list of patches to turn text1 into text2. A set of diffs will be computed. @param text1 Old text. @param text2 New text. @return List of Patch objects.

patch_make
Patch[] patch_make(Diff[] diffs)

Compute a list of patches to turn text1 into text2. text1 will be derived from the provided diffs. @param diffs Array of Diff objects for text1 to text2. @return List of Patch objects.

patch_make
Patch[] patch_make(string text1, Diff[] diffs)

Compute a list of patches to turn text1 into text2. text2 is not provided, diffs are the delta between text1 and text2. @param text1 Old text. @param diffs Array of Diff objects for text1 to text2. @return List of Patch objects.

patch_toText
string patch_toText(Patch[] patches)

Take a list of patches and return a textual representation. @param patches List of Patch objects. @return Text representation of patches.

splitMax
void splitMax(Patch[] patches)

Look through the patches and break up any which are longer than the maximum limit of the match algorithm. Intended to be called only from within patch_apply. @param patches List of Patch objects.

Structs

Patch
struct Patch
Undocumented in source.
PatchApplyResult
struct PatchApplyResult

Merge a set of patches onto the text. Return a patched text, as well as an array of true/false values indicating which patches were applied. @param patches Array of Patch objects @param text Old text. @return Two element Object array, containing the new text and an array of bool values.

Variables

MATCH_MAXBITS
int MATCH_MAXBITS;
Undocumented in source.
PATCH_DELETE_THRESHOLD
float PATCH_DELETE_THRESHOLD;
Undocumented in source.
PATCH_MARGIN
int PATCH_MARGIN;
Undocumented in source.

Meta