From efae03223ed6bf0a57b4f4174545b337a95ccf98 Mon Sep 17 00:00:00 2001 From: Mirek Kratochvil Date: Sun, 27 Sep 2020 15:55:22 +0200 Subject: [PATCH] move merge to merge --- src/Diff3.hs | 5 +++-- src/Main.hs | 7 +++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Diff3.hs b/src/Diff3.hs index 1d58152..3bc3e25 100644 --- a/src/Diff3.hs +++ b/src/Diff3.hs @@ -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))] diff --git a/src/Main.hs b/src/Main.hs index c98c5c3..3171c9e 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -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