From 815c1b1f1ca7db6beb50f003361c0e98740f0d9e Mon Sep 17 00:00:00 2001 From: Chris Penner Date: Wed, 12 Jun 2024 06:28:12 -0700 Subject: [PATCH] Auto-create project-branches referenced in transcript prompts (#5077) --- .../Codebase/SqliteCodebase/Operations.hs | 15 ++++++++++ .../Editor/HandleInput/ProjectCreate.hs | 21 +++----------- .../src/Unison/Codebase/TranscriptParser.hs | 28 +++++++++++++++--- .../transcripts-manual/gen-racket-libs.md | 1 - unison-src/transcripts/definition-diff-api.md | 5 ++-- .../transcripts/definition-diff-api.output.md | 20 ++----------- .../delete-namespace-dependents-check.md | 1 - .../transcripts/delete-project-branch.md | 1 - .../delete-project-branch.output.md | 16 ---------- .../dont-upgrade-refs-that-exist-in-old.md | 1 - unison-src/transcripts/edit-namespace.md | 1 - unison-src/transcripts/fix-ls.md | 1 - unison-src/transcripts/fix-ls.output.md | 16 ---------- unison-src/transcripts/fix4482.md | 1 - unison-src/transcripts/fix4515.md | 1 - unison-src/transcripts/fix4528.md | 1 - unison-src/transcripts/fix5055.md | 1 - unison-src/transcripts/fix5055.output.md | 16 ---------- unison-src/transcripts/fuzzy-options.md | 1 - .../transcripts/fuzzy-options.output.md | 16 ---------- unison-src/transcripts/merge.md | 29 ------------------- unison-src/transcripts/pull-errors.md | 3 -- unison-src/transcripts/pull-errors.output.md | 18 ------------ .../transcripts/release-draft-command.md | 1 - unison-src/transcripts/reset.md | 1 - unison-src/transcripts/reset.output.md | 16 ---------- unison-src/transcripts/switch-command.md | 2 -- unison-src/transcripts/tab-completion.md | 1 - .../transcripts/tab-completion.output.md | 16 ---------- .../update-suffixifies-properly.md | 1 - unison-src/transcripts/upgrade-happy-path.md | 1 - unison-src/transcripts/upgrade-sad-path.md | 1 - .../upgrade-suffixifies-properly.md | 1 - .../transcripts/upgrade-with-old-alias.md | 1 - 34 files changed, 47 insertions(+), 209 deletions(-) diff --git a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs index eee0dcec4..98a6db75e 100644 --- a/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs +++ b/parser-typechecker/src/Unison/Codebase/SqliteCodebase/Operations.hs @@ -24,11 +24,13 @@ import U.Codebase.Projects qualified as Projects import U.Codebase.Reference qualified as C.Reference import U.Codebase.Referent qualified as C.Referent import U.Codebase.Sqlite.DbId (ObjectId) +import U.Codebase.Sqlite.DbId qualified as Db import U.Codebase.Sqlite.NameLookups (PathSegments (..), ReversedName (..)) import U.Codebase.Sqlite.NamedRef qualified as S import U.Codebase.Sqlite.ObjectType qualified as OT import U.Codebase.Sqlite.Operations (NamesInPerspective (..)) import U.Codebase.Sqlite.Operations qualified as Ops +import U.Codebase.Sqlite.ProjectBranch (ProjectBranch (..)) import U.Codebase.Sqlite.Queries qualified as Q import U.Codebase.Sqlite.V2.HashHandle (v2HashHandle) import Unison.Builtin qualified as Builtins @@ -41,6 +43,7 @@ import Unison.Codebase.SqliteCodebase.Branch.Cache (BranchCache) import Unison.Codebase.SqliteCodebase.Conversions qualified as Cv import Unison.ConstructorReference (GConstructorReference (..)) import Unison.ConstructorType qualified as CT +import Unison.Core.Project (ProjectBranchName, ProjectName) import Unison.DataDeclaration (Decl) import Unison.DataDeclaration qualified as Decl import Unison.Hash (Hash) @@ -731,3 +734,15 @@ makeMaybeCachedTransaction size action = do pure \x -> do conn <- Sqlite.unsafeGetConnection Sqlite.unsafeIO (Cache.applyDefined cache (\x -> Sqlite.unsafeUnTransaction (action x) conn) x) + +insertProjectAndBranch :: Db.ProjectId -> ProjectName -> Db.ProjectBranchId -> ProjectBranchName -> Sqlite.Transaction () +insertProjectAndBranch projectId projectName branchId branchName = do + Q.insertProject projectId projectName + Q.insertProjectBranch + ProjectBranch + { projectId, + branchId, + name = branchName, + parentBranchId = Nothing + } + Q.setMostRecentBranch projectId branchId diff --git a/unison-cli/src/Unison/Codebase/Editor/HandleInput/ProjectCreate.hs b/unison-cli/src/Unison/Codebase/Editor/HandleInput/ProjectCreate.hs index 9d95ffca8..8ffe4e977 100644 --- a/unison-cli/src/Unison/Codebase/Editor/HandleInput/ProjectCreate.hs +++ b/unison-cli/src/Unison/Codebase/Editor/HandleInput/ProjectCreate.hs @@ -10,7 +10,6 @@ import Data.Text qualified as Text import Data.UUID.V4 qualified as UUID import System.Random.Shuffle qualified as RandomShuffle import U.Codebase.Sqlite.DbId -import U.Codebase.Sqlite.ProjectBranch qualified as Sqlite import U.Codebase.Sqlite.Queries qualified as Queries import Unison.Cli.DownloadUtils (downloadProjectBranchFromShare) import Unison.Cli.Monad (Cli) @@ -22,11 +21,11 @@ import Unison.Codebase qualified as Codebase import Unison.Codebase.Branch qualified as Branch import Unison.Codebase.Editor.Output qualified as Output import Unison.Codebase.Path qualified as Path +import Unison.Codebase.SqliteCodebase.Operations qualified as Ops import Unison.NameSegment qualified as NameSegment import Unison.Prelude -import Unison.Project (ProjectAndBranch (..), ProjectBranchName, ProjectName) +import Unison.Project (ProjectAndBranch (..), ProjectName) import Unison.Share.API.Hash qualified as Share.API -import Unison.Sqlite qualified as Sqlite import Unison.Sync.Common qualified as Sync.Common import Witch (unsafeFrom) @@ -73,7 +72,7 @@ projectCreate tryDownloadingBase maybeProjectName = do projectName : projectNames -> Queries.projectExistsByName projectName >>= \case False -> do - insertProjectAndBranch projectId projectName branchId branchName + Ops.insertProjectAndBranch projectId projectName branchId branchName pure projectName True -> loop projectNames loop randomProjectNames @@ -81,7 +80,7 @@ projectCreate tryDownloadingBase maybeProjectName = do Cli.runTransactionWithRollback \rollback -> do Queries.projectExistsByName projectName >>= \case False -> do - insertProjectAndBranch projectId projectName branchId branchName + Ops.insertProjectAndBranch projectId projectName branchId branchName pure projectName True -> rollback (Output.ProjectNameAlreadyExists projectName) @@ -152,18 +151,6 @@ projectCreate tryDownloadingBase maybeProjectName = do Nothing -> "project.create" Just projectName -> "project.create " <> into @Text projectName -insertProjectAndBranch :: ProjectId -> ProjectName -> ProjectBranchId -> ProjectBranchName -> Sqlite.Transaction () -insertProjectAndBranch projectId projectName branchId branchName = do - Queries.insertProject projectId projectName - Queries.insertProjectBranch - Sqlite.ProjectBranch - { projectId, - branchId, - name = branchName, - parentBranchId = Nothing - } - Queries.setMostRecentBranch projectId branchId - -- An infinite list of random project names that looks like -- -- [ diff --git a/unison-cli/src/Unison/Codebase/TranscriptParser.hs b/unison-cli/src/Unison/Codebase/TranscriptParser.hs index 9746c39f9..b9e82f7ed 100644 --- a/unison-cli/src/Unison/Codebase/TranscriptParser.hs +++ b/unison-cli/src/Unison/Codebase/TranscriptParser.hs @@ -31,6 +31,7 @@ import Data.List (isSubsequenceOf) import Data.Map qualified as Map import Data.Text qualified as Text import Data.These (These (..)) +import Data.UUID.V4 qualified as UUID import Ki qualified import Network.HTTP.Client qualified as HTTP import System.Directory (doesFileExist) @@ -39,7 +40,11 @@ import System.Exit (die) import System.IO qualified as IO import System.IO.Error (catchIOError) import Text.Megaparsec qualified as P +import U.Codebase.Sqlite.DbId qualified as Db import U.Codebase.Sqlite.Operations qualified as Operations +import U.Codebase.Sqlite.Project (Project (..)) +import U.Codebase.Sqlite.ProjectBranch (ProjectBranch (..)) +import U.Codebase.Sqlite.Queries qualified as Q import Unison.Auth.CredentialManager qualified as AuthN import Unison.Auth.HTTPClient qualified as AuthN import Unison.Auth.Tokens qualified as AuthN @@ -70,6 +75,7 @@ import Unison.Project (ProjectAndBranch (..), ProjectAndBranchNames (ProjectAndB import Unison.Runtime.Interface qualified as RTI import Unison.Server.Backend qualified as Backend import Unison.Server.CodebaseServer qualified as Server +import Unison.Sqlite qualified as Sqlite import Unison.Symbol (Symbol) import Unison.Syntax.Parser qualified as Parser import Unison.Util.Pretty qualified as Pretty @@ -349,10 +355,24 @@ run verbosity dir stanzas codebase runtime sbRuntime nRuntime config ucmVersion if curPath == path then pure Nothing else pure $ Just (SwitchBranchI (Path.absoluteToPath' path)) - UcmContextProject (ProjectAndBranch projectName branchName) -> do - ProjectAndBranch project branch <- - ProjectUtils.expectProjectAndBranchByTheseNames (These projectName branchName) - let projectAndBranchIds = ProjectAndBranch (project ^. #projectId) (branch ^. #branchId) + UcmContextProject (ProjectAndBranch projectName branchName) -> Cli.runTransaction do + Project {projectId, name = projectName} <- + Q.loadProjectByName projectName + >>= \case + Nothing -> do + projectId <- Sqlite.unsafeIO (Db.ProjectId <$> UUID.nextRandom) + Q.insertProject projectId projectName + pure $ Project {projectId, name = projectName} + Just project -> pure project + projectBranch <- + Q.loadProjectBranchByName projectId branchName >>= \case + Nothing -> do + branchId <- Sqlite.unsafeIO (Db.ProjectBranchId <$> UUID.nextRandom) + let projectBranch = ProjectBranch {projectId, parentBranchId = Nothing, branchId, name = branchName} + Q.insertProjectBranch projectBranch + pure projectBranch + Just projBranch -> pure projBranch + let projectAndBranchIds = ProjectAndBranch projectBranch.projectId projectBranch.branchId pure if curPath == ProjectUtils.projectBranchPath projectAndBranchIds then Nothing diff --git a/unison-src/transcripts-manual/gen-racket-libs.md b/unison-src/transcripts-manual/gen-racket-libs.md index 44c078db5..811ec14f5 100644 --- a/unison-src/transcripts-manual/gen-racket-libs.md +++ b/unison-src/transcripts-manual/gen-racket-libs.md @@ -4,7 +4,6 @@ When we start out, `./scheme-libs/racket` contains a bunch of library files that Next, we'll download the jit project and generate a few Racket files from it. ```ucm -.> project.create-empty jit-setup jit-setup/main> lib.install @unison/internal/releases/0.0.17 ``` diff --git a/unison-src/transcripts/definition-diff-api.md b/unison-src/transcripts/definition-diff-api.md index 922a3c277..f8d21d068 100644 --- a/unison-src/transcripts/definition-diff-api.md +++ b/unison-src/transcripts/definition-diff-api.md @@ -1,10 +1,9 @@ ```ucm -.> project.create-empty diffs diffs/main> builtins.merge ``` ```unison -term = +term = _ = "Here's some text" 1 + 1 @@ -17,7 +16,7 @@ diffs/main> branch.create new ``` ```unison -term = +term = _ = "Here's some different text" 1 + 2 diff --git a/unison-src/transcripts/definition-diff-api.output.md b/unison-src/transcripts/definition-diff-api.output.md index d0c73dc48..192367ff9 100644 --- a/unison-src/transcripts/definition-diff-api.output.md +++ b/unison-src/transcripts/definition-diff-api.output.md @@ -1,27 +1,11 @@ ```ucm -.> project.create-empty diffs - - 🎉 I've created the project diffs. - - 🎨 Type `ui` to explore this project's code in your browser. - 🔭 Discover libraries at https://share.unison-lang.org - 📖 Use `help-topic projects` to learn more about projects. - - Write your first Unison code with UCM: - - 1. Open scratch.u. - 2. Write some Unison code and save the file. - 3. In UCM, type `add` to save it to your new project. - - 🎉 🥳 Happy coding! - diffs/main> builtins.merge Done. ``` ```unison -term = +term = _ = "Here's some text" 1 + 1 @@ -59,7 +43,7 @@ diffs/main> branch.create new ``` ```unison -term = +term = _ = "Here's some different text" 1 + 2 diff --git a/unison-src/transcripts/delete-namespace-dependents-check.md b/unison-src/transcripts/delete-namespace-dependents-check.md index 9bbf7b94d..72aacc311 100644 --- a/unison-src/transcripts/delete-namespace-dependents-check.md +++ b/unison-src/transcripts/delete-namespace-dependents-check.md @@ -5,7 +5,6 @@ This is a regression test, previously `delete.namespace` allowed a delete as long as the deletions had a name _anywhere_ in your codebase, it should only check the current project branch. ```ucm:hide -.> project.create-empty myproject myproject/main> builtins.merge ``` diff --git a/unison-src/transcripts/delete-project-branch.md b/unison-src/transcripts/delete-project-branch.md index e28558c5f..c84dc95cc 100644 --- a/unison-src/transcripts/delete-project-branch.md +++ b/unison-src/transcripts/delete-project-branch.md @@ -2,7 +2,6 @@ Deleting the branch you are on takes you to its parent (though this is impossibl your working directory with each command). ```ucm -.> project.create-empty foo foo/main> branch topic foo/topic> delete.branch /topic ``` diff --git a/unison-src/transcripts/delete-project-branch.output.md b/unison-src/transcripts/delete-project-branch.output.md index 1b8baecc3..d4458e8be 100644 --- a/unison-src/transcripts/delete-project-branch.output.md +++ b/unison-src/transcripts/delete-project-branch.output.md @@ -2,22 +2,6 @@ Deleting the branch you are on takes you to its parent (though this is impossibl your working directory with each command). ```ucm -.> project.create-empty foo - - 🎉 I've created the project foo. - - 🎨 Type `ui` to explore this project's code in your browser. - 🔭 Discover libraries at https://share.unison-lang.org - 📖 Use `help-topic projects` to learn more about projects. - - Write your first Unison code with UCM: - - 1. Open scratch.u. - 2. Write some Unison code and save the file. - 3. In UCM, type `add` to save it to your new project. - - 🎉 🥳 Happy coding! - foo/main> branch topic Done. I've created the topic branch based off of main. diff --git a/unison-src/transcripts/dont-upgrade-refs-that-exist-in-old.md b/unison-src/transcripts/dont-upgrade-refs-that-exist-in-old.md index 9bd44d5a5..d74ca38e1 100644 --- a/unison-src/transcripts/dont-upgrade-refs-that-exist-in-old.md +++ b/unison-src/transcripts/dont-upgrade-refs-that-exist-in-old.md @@ -2,7 +2,6 @@ If `foo#old` exists in old, and `foo#new` exists in new, you might think `upgrad `#old` with references to `#new`. And it will... !!unless!! `#old` still exists in new. ```ucm:hide -.> project.create-empty foo foo/main> builtins.merge lib.builtin ``` diff --git a/unison-src/transcripts/edit-namespace.md b/unison-src/transcripts/edit-namespace.md index 816922fe8..ad50bc1b0 100644 --- a/unison-src/transcripts/edit-namespace.md +++ b/unison-src/transcripts/edit-namespace.md @@ -1,5 +1,4 @@ ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio lib.builtin ``` diff --git a/unison-src/transcripts/fix-ls.md b/unison-src/transcripts/fix-ls.md index 3bd9fe534..5bb9b950e 100644 --- a/unison-src/transcripts/fix-ls.md +++ b/unison-src/transcripts/fix-ls.md @@ -1,5 +1,4 @@ ```ucm -.> project.create-empty test-ls test-ls/main> builtins.merge ``` diff --git a/unison-src/transcripts/fix-ls.output.md b/unison-src/transcripts/fix-ls.output.md index 0f6b6ff1f..56277c692 100644 --- a/unison-src/transcripts/fix-ls.output.md +++ b/unison-src/transcripts/fix-ls.output.md @@ -1,20 +1,4 @@ ```ucm -.> project.create-empty test-ls - - 🎉 I've created the project test-ls. - - 🎨 Type `ui` to explore this project's code in your browser. - 🔭 Discover libraries at https://share.unison-lang.org - 📖 Use `help-topic projects` to learn more about projects. - - Write your first Unison code with UCM: - - 1. Open scratch.u. - 2. Write some Unison code and save the file. - 3. In UCM, type `add` to save it to your new project. - - 🎉 🥳 Happy coding! - test-ls/main> builtins.merge Done. diff --git a/unison-src/transcripts/fix4482.md b/unison-src/transcripts/fix4482.md index 1e4a9b1a5..380d693c8 100644 --- a/unison-src/transcripts/fix4482.md +++ b/unison-src/transcripts/fix4482.md @@ -1,5 +1,4 @@ ```ucm:hide -.> project.create-empty myproj myproj/main> builtins.merge ``` diff --git a/unison-src/transcripts/fix4515.md b/unison-src/transcripts/fix4515.md index c2dca1d63..8cae1afc2 100644 --- a/unison-src/transcripts/fix4515.md +++ b/unison-src/transcripts/fix4515.md @@ -1,5 +1,4 @@ ```ucm:hide -.> project.create-empty myproject myproject/main> builtins.merge ``` diff --git a/unison-src/transcripts/fix4528.md b/unison-src/transcripts/fix4528.md index e1b1e4f0a..c6c540c95 100644 --- a/unison-src/transcripts/fix4528.md +++ b/unison-src/transcripts/fix4528.md @@ -1,5 +1,4 @@ ```ucm:hide -.> project.create-empty foo foo/main> builtins.merge ``` diff --git a/unison-src/transcripts/fix5055.md b/unison-src/transcripts/fix5055.md index b0218766a..b5c377d38 100644 --- a/unison-src/transcripts/fix5055.md +++ b/unison-src/transcripts/fix5055.md @@ -1,5 +1,4 @@ ```ucm -.> project.create-empty test-5055 test-5055/main> builtins.merge ``` diff --git a/unison-src/transcripts/fix5055.output.md b/unison-src/transcripts/fix5055.output.md index 8dc31da20..a9fe9ee5d 100644 --- a/unison-src/transcripts/fix5055.output.md +++ b/unison-src/transcripts/fix5055.output.md @@ -1,20 +1,4 @@ ```ucm -.> project.create-empty test-5055 - - 🎉 I've created the project test-5055. - - 🎨 Type `ui` to explore this project's code in your browser. - 🔭 Discover libraries at https://share.unison-lang.org - 📖 Use `help-topic projects` to learn more about projects. - - Write your first Unison code with UCM: - - 1. Open scratch.u. - 2. Write some Unison code and save the file. - 3. In UCM, type `add` to save it to your new project. - - 🎉 🥳 Happy coding! - test-5055/main> builtins.merge Done. diff --git a/unison-src/transcripts/fuzzy-options.md b/unison-src/transcripts/fuzzy-options.md index 96294ce0a..13d953c93 100644 --- a/unison-src/transcripts/fuzzy-options.md +++ b/unison-src/transcripts/fuzzy-options.md @@ -40,7 +40,6 @@ Namespace args Project Branch args ```ucm -.> project.create-empty myproject myproject/main> branch mybranch .> debug.fuzzy-options switch _ ``` diff --git a/unison-src/transcripts/fuzzy-options.output.md b/unison-src/transcripts/fuzzy-options.output.md index d5ff9b74c..f48f5cd6f 100644 --- a/unison-src/transcripts/fuzzy-options.output.md +++ b/unison-src/transcripts/fuzzy-options.output.md @@ -65,22 +65,6 @@ Namespace args Project Branch args ```ucm -.> project.create-empty myproject - - 🎉 I've created the project myproject. - - 🎨 Type `ui` to explore this project's code in your browser. - 🔭 Discover libraries at https://share.unison-lang.org - 📖 Use `help-topic projects` to learn more about projects. - - Write your first Unison code with UCM: - - 1. Open scratch.u. - 2. Write some Unison code and save the file. - 3. In UCM, type `add` to save it to your new project. - - 🎉 🥳 Happy coding! - myproject/main> branch mybranch Done. I've created the mybranch branch based off of main. diff --git a/unison-src/transcripts/merge.md b/unison-src/transcripts/merge.md index d653b84c9..4c6549ac0 100644 --- a/unison-src/transcripts/merge.md +++ b/unison-src/transcripts/merge.md @@ -9,7 +9,6 @@ contains both additions. ## Basic merge: two unconflicted adds ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -52,7 +51,6 @@ project/alice> view foo bar If Alice and Bob also happen to add the same definition, that's not a conflict. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio project/main> branch alice ``` @@ -94,7 +92,6 @@ project/alice> view foo bar Updates that occur in one branch are propagated to the other. In this example, Alice updates `foo`, while Bob adds a new dependent `bar` of the original `foo`. When Bob's branch is merged into Alice's, her update to `foo` is propagated to his `bar`. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -150,7 +147,6 @@ We classify something as an update if its "syntactic hash"—not its normal Unis Let's see an example. We have `foo`, which depends on `bar` and `baz`. Alice updates `bar` (propagating to `foo`), and Bob updates `baz` (propagating to `foo`). When we merge their updates, both updates will be reflected in the final `foo`. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -215,7 +211,6 @@ project/alice> display foo Of course, it's also possible for Alice's update to propagate to one of Bob's updates. In this example, `foo` depends on `bar` which depends on `baz`. Alice updates `baz`, propagating to `bar` and `foo`, while Bob updates `bar` (to something that still depends on `foo`), propagating to `baz`. The merged result will have Alice's update to `foo` incorporated into Bob's updated `bar`, and both updates will propagate to `baz`. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -286,7 +281,6 @@ project/alice> display foo We don't currently consider "update + delete" a conflict like Git does. In this situation, the delete is just ignored, allowing the update to proceed. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -334,7 +328,6 @@ In a future version, we'd like to give the user a warning at least. Library dependencies don't cause merge conflicts, the library dependencies are just unioned together. If two library dependencies have the same name but different namespace hashes, then the merge algorithm makes up two fresh names. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -389,7 +382,6 @@ project/alice> view foo bar baz If Bob is equals Alice, then merging Bob into Alice looks like this. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -408,7 +400,6 @@ project/alice> merge /bob If Bob is behind Alice, then merging Bob into Alice looks like this. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -437,7 +428,6 @@ project/alice> merge /bob If Bob is ahead of Alice, then merging Bob into Alice looks like this. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -470,7 +460,6 @@ This can cause merge failures due to out-of-scope identifiers, and the user may In this example, Alice deletes `foo`, while Bob adds a new dependent of `foo`. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -514,7 +503,6 @@ It may be Alice's and Bob's changes merge together cleanly in the sense that the In this example, Alice updates a `Text` to a `Nat`, while Bob adds a new dependent of the `Text`. Upon merging, propagating Alice's update to Bob's dependent causes a typechecking failure. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -564,7 +552,6 @@ Alice and Bob may disagree about the definition of a term. In this case, the con are presented to the user to resolve. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -629,7 +616,6 @@ project/merge-bob-into-alice> view bar baz Ditto for types; if the hashes don't match, it's a conflict. In this example, Alice and Bob do different things to the same constructor. However, any explicit changes to the same type will result in a conflict, including changes that could concievably be merged (e.g. Alice and Bob both add a new constructor, or edit different constructors). ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -673,7 +659,6 @@ project/alice> merge /bob We model the renaming of a type's constructor as an update, so if Alice updates a type and Bob renames one of its constructors (even without changing its structure), we consider it a conflict. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -717,7 +702,6 @@ project/alice> merge /bob Here is another example demonstrating that constructor renames are modeled as updates. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -756,7 +740,6 @@ project/alice> merge bob A constructor on one side can conflict with a regular term definition on the other. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -798,7 +781,6 @@ project/alice> merge bob Here's a subtle situation where a new type is added on each side of the merge, and an existing term is replaced with a constructor of one of the types. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -848,7 +830,6 @@ project/alice> merge bob Here's a more involved example that demonstrates the same idea. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -928,7 +909,6 @@ which is a parse error. We will resolve this situation automatically in a future version. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -978,7 +958,6 @@ There are a number of conditions under which we can't perform a merge, and the u If `foo` and `bar` are aliases in the nearest common ancestor, but not in Alice's branch, then we don't know whether to update Bob's dependents to Alice's `foo` or Alice's `bar` (and vice-versa). ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -1036,7 +1015,6 @@ conflict involving a builtin, we can't perform a merge. One way to fix this in the future would be to introduce a syntax for defining aliases in the scratch file. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -1075,7 +1053,6 @@ project/alice> merge /bob Each naming of a decl may not have more than one name for each constructor, within the decl's namespace. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -1122,7 +1099,6 @@ project/alice> merge /bob Each naming of a decl must have a name for each constructor, within the decl's namespace. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -1170,7 +1146,6 @@ project/alice> merge /bob A decl cannot be aliased within the namespace of another of its aliased. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -1219,7 +1194,6 @@ project/alice> merge /bob Constructors may only exist within the corresponding decl's namespace. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -1264,7 +1238,6 @@ project/alice> merge bob By convention, `lib` can only namespaces; each of these represents a library dependencies. Individual terms and types are not allowed at the top level of `lib`. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -1309,7 +1282,6 @@ Here's an example. We'll delete a constructor name from the LCA and still be abl together. ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` @@ -1374,7 +1346,6 @@ project/alice> merge /bob ```ucm:hide -.> project.create-empty project project/main> builtins.mergeio ``` diff --git a/unison-src/transcripts/pull-errors.md b/unison-src/transcripts/pull-errors.md index f314ad5ab..784221bb8 100644 --- a/unison-src/transcripts/pull-errors.md +++ b/unison-src/transcripts/pull-errors.md @@ -1,6 +1,3 @@ -```ucm -.> project.create-empty test -``` ```ucm:error test/main> pull @aryairani/test-almost-empty/main lib.base_latest test/main> pull @aryairani/test-almost-empty/main a.b diff --git a/unison-src/transcripts/pull-errors.output.md b/unison-src/transcripts/pull-errors.output.md index 963eaabb5..a2894f646 100644 --- a/unison-src/transcripts/pull-errors.output.md +++ b/unison-src/transcripts/pull-errors.output.md @@ -1,22 +1,4 @@ ```ucm -.> project.create-empty test - - 🎉 I've created the project test. - - 🎨 Type `ui` to explore this project's code in your browser. - 🔭 Discover libraries at https://share.unison-lang.org - 📖 Use `help-topic projects` to learn more about projects. - - Write your first Unison code with UCM: - - 1. Open scratch.u. - 2. Write some Unison code and save the file. - 3. In UCM, type `add` to save it to your new project. - - 🎉 🥳 Happy coding! - -``` -```ucm test/main> pull @aryairani/test-almost-empty/main lib.base_latest The use of `pull` to install libraries is now deprecated. diff --git a/unison-src/transcripts/release-draft-command.md b/unison-src/transcripts/release-draft-command.md index 7a5652a07..bac0e991b 100644 --- a/unison-src/transcripts/release-draft-command.md +++ b/unison-src/transcripts/release-draft-command.md @@ -1,7 +1,6 @@ The `release.draft` command drafts a release from the current branch. ```ucm:hide -.> project.create-empty foo foo/main> builtins.merge ``` diff --git a/unison-src/transcripts/reset.md b/unison-src/transcripts/reset.md index 412b17333..a01351233 100644 --- a/unison-src/transcripts/reset.md +++ b/unison-src/transcripts/reset.md @@ -29,7 +29,6 @@ foo.a = 5 # reset branch ```ucm -.> project.create-empty foo foo/main> history ``` diff --git a/unison-src/transcripts/reset.output.md b/unison-src/transcripts/reset.output.md index d4035c925..344b2c16f 100644 --- a/unison-src/transcripts/reset.output.md +++ b/unison-src/transcripts/reset.output.md @@ -103,22 +103,6 @@ foo.a = 5 # reset branch ```ucm -.> project.create-empty foo - - 🎉 I've created the project foo. - - 🎨 Type `ui` to explore this project's code in your browser. - 🔭 Discover libraries at https://share.unison-lang.org - 📖 Use `help-topic projects` to learn more about projects. - - Write your first Unison code with UCM: - - 1. Open scratch.u. - 2. Write some Unison code and save the file. - 3. In UCM, type `add` to save it to your new project. - - 🎉 🥳 Happy coding! - foo/main> history ☝️ The namespace is empty. diff --git a/unison-src/transcripts/switch-command.md b/unison-src/transcripts/switch-command.md index d75b4a959..c1a2bca96 100644 --- a/unison-src/transcripts/switch-command.md +++ b/unison-src/transcripts/switch-command.md @@ -1,8 +1,6 @@ The `switch` command switches to an existing project or branch. ```ucm:hide -.> project.create-empty foo -.> project.create-empty bar foo/main> builtins.merge bar/main> builtins.merge ``` diff --git a/unison-src/transcripts/tab-completion.md b/unison-src/transcripts/tab-completion.md index a5c7b090e..c35c4ba34 100644 --- a/unison-src/transcripts/tab-completion.md +++ b/unison-src/transcripts/tab-completion.md @@ -69,7 +69,6 @@ add b = b ## Tab complete projects and branches ```ucm -.> project.create-empty myproject myproject/main> branch mybranch myproject/main> debug.tab-complete branch.delete /mybr myproject/main> debug.tab-complete project.rename my diff --git a/unison-src/transcripts/tab-completion.output.md b/unison-src/transcripts/tab-completion.output.md index 34ce96db9..82961cfd5 100644 --- a/unison-src/transcripts/tab-completion.output.md +++ b/unison-src/transcripts/tab-completion.output.md @@ -173,22 +173,6 @@ add b = b ## Tab complete projects and branches ```ucm -.> project.create-empty myproject - - 🎉 I've created the project myproject. - - 🎨 Type `ui` to explore this project's code in your browser. - 🔭 Discover libraries at https://share.unison-lang.org - 📖 Use `help-topic projects` to learn more about projects. - - Write your first Unison code with UCM: - - 1. Open scratch.u. - 2. Write some Unison code and save the file. - 3. In UCM, type `add` to save it to your new project. - - 🎉 🥳 Happy coding! - myproject/main> branch mybranch Done. I've created the mybranch branch based off of main. diff --git a/unison-src/transcripts/update-suffixifies-properly.md b/unison-src/transcripts/update-suffixifies-properly.md index 4cd042b49..d98395977 100644 --- a/unison-src/transcripts/update-suffixifies-properly.md +++ b/unison-src/transcripts/update-suffixifies-properly.md @@ -1,5 +1,4 @@ ```ucm:hide -.> project.create-empty myproject myproject/main> builtins.merge lib.builtin ``` diff --git a/unison-src/transcripts/upgrade-happy-path.md b/unison-src/transcripts/upgrade-happy-path.md index c234e9ac7..068c8ccf1 100644 --- a/unison-src/transcripts/upgrade-happy-path.md +++ b/unison-src/transcripts/upgrade-happy-path.md @@ -1,5 +1,4 @@ ```ucm:hide -.> project.create-empty proj proj/main> builtins.merge lib.builtin ``` diff --git a/unison-src/transcripts/upgrade-sad-path.md b/unison-src/transcripts/upgrade-sad-path.md index ccf51fd60..c2c1fe459 100644 --- a/unison-src/transcripts/upgrade-sad-path.md +++ b/unison-src/transcripts/upgrade-sad-path.md @@ -1,5 +1,4 @@ ```ucm:hide -.> project.create-empty proj proj/main> builtins.merge lib.builtin ``` diff --git a/unison-src/transcripts/upgrade-suffixifies-properly.md b/unison-src/transcripts/upgrade-suffixifies-properly.md index 5aba271c1..08c4b002d 100644 --- a/unison-src/transcripts/upgrade-suffixifies-properly.md +++ b/unison-src/transcripts/upgrade-suffixifies-properly.md @@ -1,5 +1,4 @@ ```ucm:hide -.> project.create-empty myproject myproject/main> builtins.merge lib.builtin ``` diff --git a/unison-src/transcripts/upgrade-with-old-alias.md b/unison-src/transcripts/upgrade-with-old-alias.md index ed1ae1c18..aeb818947 100644 --- a/unison-src/transcripts/upgrade-with-old-alias.md +++ b/unison-src/transcripts/upgrade-with-old-alias.md @@ -1,5 +1,4 @@ ```ucm:hide -.> project.create-empty myproject myproject/main> builtins.merge lib.builtin ```