mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 10:35:57 +03:00
load alice and bob branches
This commit is contained in:
parent
8de150bf32
commit
b046acb857
@ -78,6 +78,7 @@ dependencies:
|
||||
- unison-core
|
||||
- unison-core1
|
||||
- unison-hash
|
||||
- unison-merge
|
||||
- unison-parser-typechecker
|
||||
- unison-prelude
|
||||
- unison-pretty-printer
|
||||
|
@ -8,6 +8,7 @@ module Unison.Cli.ProjectUtils
|
||||
getCurrentProjectBranch,
|
||||
getProjectBranchForPath,
|
||||
expectCurrentProjectBranch,
|
||||
expectProjectBranchByName,
|
||||
projectPath,
|
||||
projectBranchesPath,
|
||||
projectBranchPath,
|
||||
@ -125,6 +126,11 @@ getCurrentProjectBranch = do
|
||||
path <- Cli.getCurrentPath
|
||||
getProjectBranchForPath path
|
||||
|
||||
expectProjectBranchByName :: Sqlite.Project -> ProjectBranchName -> Cli Sqlite.ProjectBranch
|
||||
expectProjectBranchByName project branchName =
|
||||
Cli.runTransaction (Queries.loadProjectBranchByName (project ^. #projectId) branchName) & onNothingM do
|
||||
Cli.returnEarly (LocalProjectBranchDoesntExist (ProjectAndBranch (project ^. #name) branchName))
|
||||
|
||||
getProjectBranchForPath :: Path.Absolute -> Cli (Maybe (ProjectAndBranch Sqlite.Project Sqlite.ProjectBranch, Path.Path))
|
||||
getProjectBranchForPath path = do
|
||||
case preview projectBranchPathPrism path of
|
||||
|
@ -3,8 +3,29 @@ module Unison.Codebase.Editor.HandleInput.Merge2
|
||||
)
|
||||
where
|
||||
|
||||
import Unison.Core.Project (ProjectBranchName)
|
||||
import Control.Monad.Reader (ask)
|
||||
import Unison.Prelude
|
||||
import Control.Lens (Lens', over, view, (%=), (.=), (.~), (^.))
|
||||
import Unison.Merge.Database (MergeDatabase(..), makeMergeDatabase)
|
||||
import Unison.Cli.Monad (Cli)
|
||||
import Unison.Cli.Monad qualified as Cli
|
||||
import Unison.Project (ProjectAndBranch (..), ProjectBranchName)
|
||||
import Unison.Cli.MonadUtils qualified as Cli
|
||||
import Unison.Cli.ProjectUtils qualified as Cli
|
||||
import Unison.Cli.TypeCheck (computeTypecheckingEnvironment, typecheckTerm)
|
||||
import Unison.Cli.UniqueTypeGuidLookup qualified as Cli
|
||||
import Unison.Merge.Diff qualified as Merge
|
||||
|
||||
handleMerge :: ProjectBranchName -> Cli ()
|
||||
handleMerge = undefined
|
||||
handleMerge bobBranchName = do
|
||||
-- Load the current project branch ("alice"), and the branch from the same project to merge in ("bob")
|
||||
(ProjectAndBranch project aliceProjectBranch, _path) <- Cli.expectCurrentProjectBranch
|
||||
bobProjectBranch <- Cli.expectProjectBranchByName project bobBranchName
|
||||
let projectBranches = Merge.TwoWay {alice = aliceProjectBranch, bob = bobProjectBranch}
|
||||
let alicePath = Cli.projectBranchPath (ProjectAndBranch (project ^. #projectId) (aliceProjectBranch ^. #branchId))
|
||||
let bobPath = Cli.projectBranchPath (ProjectAndBranch (project ^. #projectId) (bobProjectBranch ^. #branchId))
|
||||
|
||||
-- Create a bunch of cached database lookup functions
|
||||
Cli.Env {codebase} <- ask
|
||||
db@MergeDatabase {loadCausal} <- makeMergeDatabase codebase
|
||||
undefined
|
||||
|
@ -239,6 +239,7 @@ library
|
||||
, unison-core
|
||||
, unison-core1
|
||||
, unison-hash
|
||||
, unison-merge
|
||||
, unison-parser-typechecker
|
||||
, unison-prelude
|
||||
, unison-pretty-printer
|
||||
@ -378,6 +379,7 @@ executable cli-integration-tests
|
||||
, unison-core
|
||||
, unison-core1
|
||||
, unison-hash
|
||||
, unison-merge
|
||||
, unison-parser-typechecker
|
||||
, unison-prelude
|
||||
, unison-pretty-printer
|
||||
@ -512,6 +514,7 @@ executable transcripts
|
||||
, unison-core
|
||||
, unison-core1
|
||||
, unison-hash
|
||||
, unison-merge
|
||||
, unison-parser-typechecker
|
||||
, unison-prelude
|
||||
, unison-pretty-printer
|
||||
@ -652,6 +655,7 @@ executable unison
|
||||
, unison-core
|
||||
, unison-core1
|
||||
, unison-hash
|
||||
, unison-merge
|
||||
, unison-parser-typechecker
|
||||
, unison-prelude
|
||||
, unison-pretty-printer
|
||||
@ -795,6 +799,7 @@ test-suite cli-tests
|
||||
, unison-core
|
||||
, unison-core1
|
||||
, unison-hash
|
||||
, unison-merge
|
||||
, unison-parser-typechecker
|
||||
, unison-prelude
|
||||
, unison-pretty-printer
|
||||
|
Loading…
Reference in New Issue
Block a user