From 036793ee78b5ae91e5ccf32e82cd366ee14bdfeb Mon Sep 17 00:00:00 2001 From: Mitchell Dalvi Rosen Date: Tue, 3 Dec 2024 12:20:26 -0500 Subject: [PATCH] tweaks --- .../Codebase/Editor/HandleInput/Merge2.hs | 17 ++++++++++++----- unison-merge/src/Unison/Merge/Diff.hs | 9 +++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/Merge2.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/Merge2.hs index 353c29763e..8dc383882e 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/Merge2.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/Merge2.hs @@ -238,8 +238,17 @@ doMerge info = do Cli.runTransactionWithRollback2 (\rollback -> Right <$> action (rollback . Left)) & onLeftM (done . Output.ConflictedDefn "merge") + libdeps3 <- Cli.runTransaction (loadLibdeps branches) + + let blob0 = Merge.makeMergeblob0 nametrees3 libdeps3 + names3 :: Merge.ThreeWay Names <- do - let causalHashes = Merge.TwoOrThreeWay {alice = info.alice.causalHash, bob = info.bob.causalHash, lca = info.lca.causalHash} + let causalHashes = + Merge.TwoOrThreeWay + { alice = info.alice.causalHash, + bob = info.bob.causalHash, + lca = info.lca.causalHash + } branches <- for causalHashes \ch -> do liftIO (Codebase.getBranchForHash env.codebase ch) >>= \case Nothing -> done (Output.CouldntLoadBranch ch) @@ -247,9 +256,7 @@ doMerge info = do let names = fmap (Branch.toNames . Branch.head) branches pure Merge.ThreeWay {alice = names.alice, bob = names.bob, lca = fromMaybe mempty names.lca} - libdeps3 <- Cli.runTransaction (loadLibdeps branches) - - let blob0 = Merge.makeMergeblob0 nametrees3 libdeps3 + respondRegion (Output.Literal "Loading definitions...") -- Hydrate hydratedDefns :: @@ -270,7 +277,7 @@ doMerge info = do in bimap f g <$> blob0.defns ) - respondRegion (Output.Literal "Computing diff between branches...") + respondRegion (Output.Literal "Computing diffs...") blob1 <- Merge.makeMergeblob1 blob0 names3 hydratedDefns & onLeft \case diff --git a/unison-merge/src/Unison/Merge/Diff.hs b/unison-merge/src/Unison/Merge/Diff.hs index b4d6730d85..0b6e4c8332 100644 --- a/unison-merge/src/Unison/Merge/Diff.hs +++ b/unison-merge/src/Unison/Merge/Diff.hs @@ -120,11 +120,8 @@ humanizeDiffs :: TwoWay (DefnsF2 (Map Name) Updated Referent TypeReference) -> TwoWay (DefnsF2 (Map Name) HumanDiffOp Referent TypeReference) humanizeDiffs names3 diffs propagatedUpdates = - zipWithF3 - nameRelations - diffs - propagatedUpdates - \relation diffOps propagatedUpdates -> Defns.zipDefnsWith4 computeHumanDiffOp computeHumanDiffOp lcaRelation relation diffOps propagatedUpdates + zipWithF3 nameRelations diffs propagatedUpdates \relation diffOps propagatedUpdates -> + Defns.zipDefnsWith4 computeHumanDiffOp computeHumanDiffOp lcaRelation relation diffOps propagatedUpdates where zipWithF3 :: (Zip.Zip f) => f a -> f b -> f c -> (a -> b -> c -> d) -> f d zipWithF3 a b c f = Zip.zipWith (\(x, y) z -> f x y z) (Zip.zip a b) c @@ -148,7 +145,7 @@ humanizeDiffs names3 diffs propagatedUpdates = go :: These (DiffOp (Synhashed ref)) (Updated ref) -> (HumanDiffOp ref) go = \case This diff -> humanizeDiffOp (Synhashed.value <$> diff) - That updated -> (HumanDiffOp'PropagatedUpdate updated) + That updated -> HumanDiffOp'PropagatedUpdate updated These diff updated -> error (reportBug "E488729" ("The impossible happened, an update in merge was detected as both a propagated AND core update " ++ show diff ++ " and " ++ show updated)) humanizeDiffOp :: DiffOp ref -> HumanDiffOp ref