move merge to merge
This commit is contained in:
parent
94b5950ca5
commit
efae03223e
|
@ -3,6 +3,7 @@ module Diff3 where
|
||||||
|
|
||||||
import Diff
|
import Diff
|
||||||
import Types
|
import Types
|
||||||
|
import Merge
|
||||||
|
|
||||||
data Origin
|
data Origin
|
||||||
= Stable
|
= Stable
|
||||||
|
@ -10,8 +11,8 @@ data Origin
|
||||||
| Your
|
| Your
|
||||||
deriving (Show, Eq)
|
deriving (Show, Eq)
|
||||||
|
|
||||||
--diff3Toks :: TV -> TV -> TV -> Diff
|
diff3Toks :: MergeOpts -> TV -> TV -> TV -> Diff
|
||||||
diff3Toks tMine tOrig tYour =
|
diff3Toks mo tMine tOrig tYour =
|
||||||
conflict $ align (diffToks tOrig tMine) (diffToks tOrig tYour)
|
conflict $ align (diffToks tOrig tMine) (diffToks tOrig tYour)
|
||||||
where
|
where
|
||||||
align :: Diff -> Diff -> [(Origin, (Op, Tok))]
|
align :: Diff -> Diff -> [(Origin, (Op, Tok))]
|
||||||
|
|
|
@ -101,7 +101,7 @@ actionOption =
|
||||||
adiffOptions = ADiffOptions <$> redfaOption <*> actionOption
|
adiffOptions = ADiffOptions <$> redfaOption <*> actionOption
|
||||||
|
|
||||||
loadToks redfa f =
|
loadToks redfa f =
|
||||||
mmapFileByteString f Nothing >>= (V.fromList <$> redfaTokenize redfa)
|
V.fromList <$> (mmapFileByteString f Nothing >>= redfaTokenize redfa)
|
||||||
|
|
||||||
main :: IO ()
|
main :: IO ()
|
||||||
main =
|
main =
|
||||||
|
@ -125,9 +125,8 @@ main =
|
||||||
CmdDiff3 ctxt f1 f2 f3 mo -> do
|
CmdDiff3 ctxt f1 f2 f3 mo -> do
|
||||||
[toksMine, toksOld, toksYour] <-
|
[toksMine, toksOld, toksYour] <-
|
||||||
traverse (loadToks redfa) [f1, f2, f3]
|
traverse (loadToks redfa) [f1, f2, f3]
|
||||||
let d3 = diff3Toks toksMine toksOld toksYour
|
let d3 = diff3Toks mo toksMine toksOld toksYour
|
||||||
BB.hPutBuilder stdout $
|
BB.hPutBuilder stdout $
|
||||||
if mergeDoMerge mo
|
if mergeDoMerge mo
|
||||||
then fmtMerged mo d3
|
then fmtMerged mo d3
|
||||||
else pprHunks $
|
else pprHunks $ hunks (max 0 ctxt) d3
|
||||||
hunks (max 0 ctxt) $ diff3Toks toksMine toksOld toksYour
|
|
||||||
|
|
Loading…
Reference in a new issue