2 Wiggle - wiggle a mis-match patch into a file.
6 2/ a patch - which is two file fragments
8 find the minimal differences between the fragments in the patch
9 and apply those to the file.
10 This requires us to do a word-diff of file with frag-A, and
11 frag-A with frag-B, and the merge the result.
13 We read in the file and 2 frags and break them into words and keeping
14 an index and hash for each.
16 We then perform the two diffs producing lists of inserts and deletes.
23 describe and implement correct replacement procedure
24 Reject matches that have a dis-proportionate cost
25 implement testing structure. DONE
30 A directory tree containing tests. We look for key files
31 and run the appropriate test.
33 script : run that script in that directory
34 diff : if new exists, diff orig with new
35 else diff 'orig' with -1 of 'patch'
36 ldiff : as above, but lines
37 rediff : rediff 'patch'
38 merge : if 'patch' merge 'orig' with 'patch'
39 else merge 'orig' 'new' 'new2'
42 Replacement procedure:
44 Goal: Every change between A' and B' must be merged into
45 A somehow to produce B.
47 We can think of changes as additions, deletions, or replacements.
49 Every addition must be inserted somewhere, at the site of
50 best match for the context. If there is no good match...
51 I guess we insert at start or finish.
53 Every deletion is merged either by deleting matching text,
54 or inserting the string <<<---deleted-text--->>> and some
55 reasonably appropriate location.
57 Every replacement is merged either by removing the original
58 and replacing by the new, or by inserting
59 <<<---oldtext///newtext+++>>>
62 For each difference b->c between B and C:
63 if b precisely aligns with a in A, then replace a with c
64 else find some set of lines that b maybe is in and produce:
75 Maybe several (two?) passes.
77 -mw orig new new2 in tests/test dies. - FIXED
79 in test5, -dw orig new
80 produces strange output FIXED
83 if no matches are found, core is domps as lcsl is NULL FIXED
85 wdiff to look more like udiff
89 |change<<<+++additions+++>>> and <<<---deletions--->>>>
92 @@ line,numbers @@ in diff output
94 Speed: us aproxword for pdiff lineup.DONE
96 "refine" takes a diff and refines it, sortof
98 return a lcsl when reading a patch and refine that
99 rather than computing from scratch.
101 FIXME: pdiff should pick best bit, and rediff the two sides. DONE