Clean up transcript so it's easier to follow and add more verbiage

This commit is contained in:
Paul Chiusano 2021-05-26 08:22:50 -05:00
parent a0de0be3c9
commit 6ac56a68db

View File

@ -3,24 +3,41 @@
.> builtins.merge
```
Here's the scenario that can produce bad empty namespace LCAs:
```
deletes of v4
j1: ... - v1 - v2 - v3 - v4 - v4a - v5 - v6 - v7
/
<empty> - v5a
adds of unrelated
j2: ... - v1 - v2 - v3 - v4 - x0 - x1 - x2 - x3
/
<empty> - z1
```
So `j1` and `j2` have common history up through `v4`, then `j1` deletes some definitions while `j2` adds some definitions via shallow merges. These shallow merges then result in the LCA being the empty namespace rather than `v4`.
First, we create some common history before a fork:
```ucm
.a> alias.term .builtin.Nat.+ Nat.add
.a> alias.term .builtin.Nat.* Nat.times
.a> alias.term .builtin.Nat.drop Nat.subtract
.a> alias.type .builtin.Nat Nonneg
.a> alias.term .builtin.Nat.+ delete1
.a> alias.term .builtin.Nat.* delete2
.a> alias.term .builtin.Nat.drop delete3
.a> alias.type .builtin.Nat Delete4
```
Now we fork `a2` off of `a`. `a` continues on, deleting the terms it added previously and then adding one unrelated term via a merge with little history.
Now we fork `a2` off of `a`. `a` continues on, deleting the terms it added previously and then adding one unrelated term via a merge with little history. It's this short history merge which will become a bad LCA of the empty namespace.
```ucm
.> fork a a2
.a> delete.term Nat.add
.a> delete.term Nat.times
.a> delete.term Nat.subtract
.a> delete.type Nonneg
.newbranchA> alias.term .builtin.Float.+ addSomeFloats
.a> delete.term delete1
.a> delete.term delete2
.a> delete.term delete3
.a> delete.type Delete4
.newbranchA> alias.term .builtin.Float.+ dontDelete
.> merge newbranchA a
.a> find
```
@ -28,12 +45,12 @@ Now we fork `a2` off of `a`. `a` continues on, deleting the terms it added previ
Meanwhile, `a2` adds some other unrelated terms, some via merging in namespaces with little history. When merging `a2` back into `a`, the deletes from their common history should be respected.
```ucm
.a2> alias.term .builtin.Text.drop drop1
.a2> alias.term .builtin.Text.drop drop2
.a2> alias.term .builtin.Text.drop drop3
.a2> alias.term .builtin.Text.drop drop4
.a2> alias.term .builtin.Text.drop drop5
.newbranchA2> alias.term .builtin.Text.drop drop6
.a2> alias.term .builtin.Text.take keep1
.a2> alias.term .builtin.Text.take keep2
.a2> alias.term .builtin.Text.take keep3
.a2> alias.term .builtin.Text.take keep4
.a2> alias.term .builtin.Text.take keep5
.newbranchA2> alias.term .builtin.Text.take keep6
.> merge newbranchA2 a2
.a2> find
```
@ -49,10 +66,15 @@ Meanwhile, `a2` adds some other unrelated terms, some via merging in namespaces
.asquash> find
```
```ucm:error
.> view a.Nonneg
```ucm:hide
.> view a.keep1 a.keep2 a.keep3
.> view asquash.keep1 asquash.keep2 asquash.keep3
```
```ucm:error
.> view asquash.Nat.add
.> view a.Delete4
```
```ucm:error
.> view asquash.delete1
```