Copyright | (c) David Fox (2015) |
---|---|
License | BSD 3 Clause |
Maintainer | s.clover@gmail.com |
Stability | experimental |
Portability | portable |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Generates a grouped diff with merged runs, and outputs them in the manner of diff -u
Synopsis
- getContextDiffNew :: Eq a => Maybe Int -> [a] -> [a] -> ContextDiff a
- getContextDiff :: Eq a => Int -> [a] -> [a] -> ContextDiff a
- getContextDiffOld :: Eq a => Int -> [a] -> [a] -> ContextDiff a
- prettyContextDiff :: Doc -> Doc -> (c -> Doc) -> ContextDiff c -> Doc
Documentation
:: Eq a | |
=> Maybe Int | Number of context elements, Nothing means infinite |
-> [a] | |
-> [a] | |
-> ContextDiff a |
See https://github.com/seereason/Diff/commit/35596ca45fdd6ee2559cf610bef7a86b4617988a.
The original getContextDiff
omitted trailing context in diff hunks.
This new one corrects the issue. Here is the example from the test
suite:
prettyContextDiff (text "file1") (text "file2") text (getContextDiffOld 2 (lines textA) (lines textB))
- -- file1 +++ file2 @@ a b
- c
@
d e
@ i j - k
prettyContextDiff (text "file1") (text "file2") text (getContextDiff 2 (lines textA) (lines textB))
- -- file1 +++ file2 @@ a b
- c d e @@ i j
- k
getContextDiff :: Eq a => Int -> [a] -> [a] -> ContextDiff a Source #
getContextDiffOld :: Eq a => Int -> [a] -> [a] -> ContextDiff a Source #
Do a grouped diff and then split up the chunks into runs that contain differences surrounded by N lines of unchanged text. If there is less then 2N+1 lines of unchanged text between two changes, the runs are left merged.