mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-11 02:25:39 +03:00
Merge branch 'trunk' into 24-08-01-merge-api
This commit is contained in:
commit
ed555a3ea1
@ -3500,7 +3500,11 @@ getProjectReflog numEntries projectId =
|
||||
SELECT project_id, project_branch_id, time, from_root_causal_id, to_root_causal_id, reason
|
||||
FROM project_branch_reflog
|
||||
WHERE project_id = :projectId
|
||||
ORDER BY time DESC
|
||||
ORDER BY
|
||||
time DESC,
|
||||
-- Strictly for breaking ties in transcripts with the same time,
|
||||
-- this will break ties in the correct order, sorting later inserted rows first.
|
||||
ROWID DESC
|
||||
LIMIT :numEntries
|
||||
|]
|
||||
|
||||
@ -3512,7 +3516,11 @@ getProjectBranchReflog numEntries projectBranchId =
|
||||
SELECT project_id, project_branch_id, time, from_root_causal_id, to_root_causal_id, reason
|
||||
FROM project_branch_reflog
|
||||
WHERE project_branch_id = :projectBranchId
|
||||
ORDER BY time DESC
|
||||
ORDER BY
|
||||
time DESC,
|
||||
-- Strictly for breaking ties in transcripts with the same time,
|
||||
-- this will break ties in the correct order, sorting later inserted rows first.
|
||||
ROWID DESC
|
||||
LIMIT :numEntries
|
||||
|]
|
||||
|
||||
@ -3523,7 +3531,11 @@ getGlobalReflog numEntries =
|
||||
[sql|
|
||||
SELECT project_id, project_branch_id, time, from_root_causal_id, to_root_causal_id, reason
|
||||
FROM project_branch_reflog
|
||||
ORDER BY time DESC
|
||||
ORDER BY
|
||||
time DESC,
|
||||
-- Strictly for breaking ties in transcripts with the same time,
|
||||
-- this will break ties in the correct order, sorting later inserted rows first.
|
||||
ROWID DESC
|
||||
LIMIT :numEntries
|
||||
|]
|
||||
|
||||
|
@ -7,7 +7,7 @@ module Unison.Codebase.Editor.HandleInput.Update2
|
||||
)
|
||||
where
|
||||
|
||||
import Control.Lens (mapped)
|
||||
import Control.Lens (mapped, (.=))
|
||||
import Control.Monad.Reader.Class (ask)
|
||||
import Data.Bifoldable (bifoldMap)
|
||||
import Data.Foldable qualified as Foldable
|
||||
@ -167,6 +167,7 @@ handleUpdate2 = do
|
||||
(\typeName -> Right (Map.lookup typeName declNameLookup.declToConstructors))
|
||||
secondTuf
|
||||
Cli.stepAt "update" (path, Branch.batchUpdates branchUpdates)
|
||||
#latestTypecheckedFile .= Nothing
|
||||
|
||||
Cli.respond Output.Success
|
||||
|
||||
|
@ -59,5 +59,17 @@ diffSyntaxText (AnnotatedText fromST) (AnnotatedText toST) =
|
||||
detectSpecialCase fromSegment toSegment
|
||||
| fromSegment == toSegment = Left fromSegment
|
||||
| AT.annotation fromSegment == AT.annotation toSegment = Right (SegmentChange (AT.segment fromSegment, AT.segment toSegment) (AT.annotation fromSegment))
|
||||
| AT.segment fromSegment == AT.segment toSegment = Right (AnnotationChange (AT.segment fromSegment) (AT.annotation fromSegment, AT.annotation toSegment))
|
||||
-- We only emit an annotation change if it's a change in just the hash of the element (optionally the KIND of hash reference can change too).
|
||||
| AT.segment fromSegment == AT.segment toSegment,
|
||||
Just _fromHash <- AT.annotation fromSegment >>= elementHash,
|
||||
Just _toHash <- AT.annotation toSegment >>= elementHash =
|
||||
Right (AnnotationChange (AT.segment fromSegment) (AT.annotation fromSegment, AT.annotation toSegment))
|
||||
| otherwise = error "diffSyntaxText: found Syntax Elements in 'both' which have nothing in common."
|
||||
where
|
||||
elementHash :: Syntax.Element -> Maybe Syntax.UnisonHash
|
||||
elementHash = \case
|
||||
Syntax.TypeReference hash -> Just hash
|
||||
Syntax.TermReference hash -> Just hash
|
||||
Syntax.DataConstructorReference hash -> Just hash
|
||||
Syntax.AbilityConstructorReference hash -> Just hash
|
||||
_ -> Nothing
|
||||
|
@ -1,5 +1,7 @@
|
||||
```ucm
|
||||
diffs/main> builtins.merge
|
||||
diffs/main> builtins.mergeio lib.builtins
|
||||
diffs/main> alias.term lib.builtins.Nat.gt lib.builtins.Nat.>
|
||||
diffs/main> alias.term lib.builtins.Nat.drop lib.builtins.Nat.-
|
||||
```
|
||||
|
||||
```unison
|
||||
@ -8,6 +10,20 @@ term =
|
||||
1 + 1
|
||||
|
||||
type Type = Type Nat
|
||||
|
||||
ability Stream a where
|
||||
emit : a -> ()
|
||||
|
||||
take n s =
|
||||
use Nat > -
|
||||
h n = cases
|
||||
{ emit a -> k } -> if n > 0
|
||||
then
|
||||
emit a
|
||||
handle k() with h (n - 1)
|
||||
else None
|
||||
{ r } -> Some r
|
||||
handle s() with h n
|
||||
```
|
||||
|
||||
```ucm
|
||||
@ -21,6 +37,22 @@ term =
|
||||
1 + 2
|
||||
|
||||
type Type a = Type a Text
|
||||
|
||||
ability Stream a where
|
||||
emit : a -> ()
|
||||
|
||||
take n s =
|
||||
use Nat > -
|
||||
h n = cases
|
||||
{ emit a -> k } ->
|
||||
emit a
|
||||
if n > 0
|
||||
then handle k() with h (n - 1)
|
||||
else None
|
||||
{ r } -> Some r
|
||||
if n > 0
|
||||
then handle s () with h (n - 1)
|
||||
else None
|
||||
```
|
||||
|
||||
```ucm
|
||||
@ -33,6 +65,13 @@ Diff terms
|
||||
GET /api/projects/diffs/diff/terms?oldBranchRef=main&newBranchRef=new&oldTerm=term&newTerm=term
|
||||
```
|
||||
|
||||
More complex diff
|
||||
|
||||
```api
|
||||
GET /api/projects/diffs/diff/terms?oldBranchRef=main&newBranchRef=new&oldTerm=take&newTerm=take
|
||||
```
|
||||
|
||||
|
||||
Diff types
|
||||
|
||||
```api
|
||||
|
File diff suppressed because it is too large
Load Diff
26
unison-src/transcripts/fix3424.md
Normal file
26
unison-src/transcripts/fix3424.md
Normal file
@ -0,0 +1,26 @@
|
||||
```ucm
|
||||
scratch/main> builtins.merge lib.builtins
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
a = do b
|
||||
b = "Hello, " ++ c ++ "!"
|
||||
c = "World"
|
||||
```
|
||||
|
||||
```ucm
|
||||
scratch/main> add
|
||||
scratch/main> run a
|
||||
```
|
||||
|
||||
```unison:hide
|
||||
a = do b
|
||||
c = "Unison"
|
||||
```
|
||||
|
||||
```ucm
|
||||
scratch/main> update
|
||||
scratch/main> run a
|
||||
```
|
||||
|
||||
The result should be "Hello, Unison!".
|
50
unison-src/transcripts/fix3424.output.md
Normal file
50
unison-src/transcripts/fix3424.output.md
Normal file
@ -0,0 +1,50 @@
|
||||
``` ucm
|
||||
scratch/main> builtins.merge lib.builtins
|
||||
|
||||
Done.
|
||||
|
||||
```
|
||||
``` unison
|
||||
a = do b
|
||||
b = "Hello, " ++ c ++ "!"
|
||||
c = "World"
|
||||
```
|
||||
|
||||
``` ucm
|
||||
scratch/main> add
|
||||
|
||||
⍟ I've added these definitions:
|
||||
|
||||
a : 'Text
|
||||
b : Text
|
||||
c : Text
|
||||
|
||||
scratch/main> run a
|
||||
|
||||
"Hello, World!"
|
||||
|
||||
```
|
||||
``` unison
|
||||
a = do b
|
||||
c = "Unison"
|
||||
```
|
||||
|
||||
``` ucm
|
||||
scratch/main> update
|
||||
|
||||
Okay, I'm searching the branch for code that needs to be
|
||||
updated...
|
||||
|
||||
That's done. Now I'm making sure everything typechecks...
|
||||
|
||||
Everything typechecks, so I'm saving the results...
|
||||
|
||||
Done.
|
||||
|
||||
scratch/main> run a
|
||||
|
||||
"Hello, Unison!"
|
||||
|
||||
```
|
||||
The result should be "Hello, Unison\!".
|
||||
|
Loading…
Reference in New Issue
Block a user