move merge to merge

This commit is contained in:
Mirek Kratochvil 2020-09-27 15:55:22 +02:00
parent 94b5950ca5
commit efae03223e
2 changed files with 6 additions and 6 deletions

View file

@ -3,6 +3,7 @@ module Diff3 where
import Diff
import Types
import Merge
data Origin
= Stable
@ -10,8 +11,8 @@ data Origin
| Your
deriving (Show, Eq)
--diff3Toks :: TV -> TV -> TV -> Diff
diff3Toks tMine tOrig tYour =
diff3Toks :: MergeOpts -> TV -> TV -> TV -> Diff
diff3Toks mo tMine tOrig tYour =
conflict $ align (diffToks tOrig tMine) (diffToks tOrig tYour)
where
align :: Diff -> Diff -> [(Origin, (Op, Tok))]

View file

@ -101,7 +101,7 @@ actionOption =
adiffOptions = ADiffOptions <$> redfaOption <*> actionOption
loadToks redfa f =
mmapFileByteString f Nothing >>= (V.fromList <$> redfaTokenize redfa)
V.fromList <$> (mmapFileByteString f Nothing >>= redfaTokenize redfa)
main :: IO ()
main =
@ -125,9 +125,8 @@ main =
CmdDiff3 ctxt f1 f2 f3 mo -> do
[toksMine, toksOld, toksYour] <-
traverse (loadToks redfa) [f1, f2, f3]
let d3 = diff3Toks toksMine toksOld toksYour
let d3 = diff3Toks mo toksMine toksOld toksYour
BB.hPutBuilder stdout $
if mergeDoMerge mo
then fmtMerged mo d3
else pprHunks $
hunks (max 0 ctxt) $ diff3Toks toksMine toksOld toksYour
else pprHunks $ hunks (max 0 ctxt) d3