From df9e78138fdd82fb70da7466e5bcf54807f4425e Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Thu, 27 Jun 2024 11:12:21 -0400 Subject: [PATCH 1/4] in delete.md, replace uses of merge.old with debug.alias.{term,type}.force --- unison-src/transcripts/delete.md | 34 +------- unison-src/transcripts/delete.output.md | 100 +++--------------------- 2 files changed, 17 insertions(+), 117 deletions(-) diff --git a/unison-src/transcripts/delete.md b/unison-src/transcripts/delete.md index e3e27ede98..aadb7a602f 100644 --- a/unison-src/transcripts/delete.md +++ b/unison-src/transcripts/delete.md @@ -32,28 +32,18 @@ How about an ambiguous term? ```unison:hide foo = 1 +bar = 2 ``` ```ucm .a> add -``` - -```unison:hide -foo = 2 -``` - -```ucm -.b> add -.a> merge.old .b +.a> debug.alias.term.force bar foo ``` A delete should remove both versions of the term. ```ucm .> delete.verbose a.foo -``` - -```ucm:error .a> ls ``` @@ -61,26 +51,13 @@ Let's repeat all that on a type, for completeness. ```unison:hide structural type Foo = Foo () +structural type Bar = Bar ``` ```ucm .a> add -``` - -```unison:hide -structural type Foo = Foo -``` - -```ucm -.b> add -.a> merge.old .b -``` - -```ucm +.a> debug.alias.type.force Bar Foo .> delete.verbose a.Foo -``` - -```ucm .> delete.verbose a.Foo.Foo ``` @@ -93,9 +70,6 @@ structural type foo = Foo () ```ucm .> add -``` - -```ucm .> delete.verbose foo ``` diff --git a/unison-src/transcripts/delete.output.md b/unison-src/transcripts/delete.output.md index 02b757d4c4..14ca930fe1 100644 --- a/unison-src/transcripts/delete.output.md +++ b/unison-src/transcripts/delete.output.md @@ -59,6 +59,7 @@ How about an ambiguous term? ```unison foo = 1 +bar = 2 ``` ```ucm @@ -68,40 +69,12 @@ foo = 1 ⍟ I've added these definitions: + bar : ##Nat foo : ##Nat -``` -```unison -foo = 2 -``` +.a> debug.alias.term.force bar foo -```ucm - ☝️ The namespace .b is empty. - -.b> add - - ⍟ I've added these definitions: - - foo : ##Nat - -.a> merge.old .b - - Here's what's changed in the current namespace after the - merge: - - New name conflicts: - - 1. foo#gjmq673r1v : ##Nat - ↓ - 2. ┌ foo#dcgdua2lj6 : ##Nat - 3. └ foo#gjmq673r1v : ##Nat - - Tip: You can use `todo` to see if this generated any work to - do in this namespace and `test` to run the tests. Or you - can use `undo` or `reflog` to undo the results of this - merge. - - Applying changes from patch... + Done. ``` A delete should remove both versions of the term. @@ -116,24 +89,21 @@ A delete should remove both versions of the term. Name changes: Original Changes - 2. b.foo ┐ 3. a.foo#dcgdua2lj6 (removed) + 2. a.bar ┐ 3. a.foo#dcgdua2lj6 (removed) 4. a.foo#dcgdua2lj6 ┘ Tip: You can use `undo` or `reflog` to undo this change. -``` -```ucm - ☝️ The namespace .a is empty. - .a> ls - nothing to show + 1. bar (##Nat) ``` Let's repeat all that on a type, for completeness. ```unison structural type Foo = Foo () +structural type Bar = Bar ``` ```ucm @@ -141,46 +111,13 @@ structural type Foo = Foo () ⍟ I've added these definitions: + structural type Bar structural type Foo -``` -```unison -structural type Foo = Foo -``` - -```ucm -.b> add - - ⍟ I've added these definitions: - - structural type Foo - -.a> merge.old .b +.a> debug.alias.type.force Bar Foo - Here's what's changed in the current namespace after the - merge: - - New name conflicts: - - 1. structural type Foo#089vmor9c5 - ↓ - 2. ┌ structural type Foo#00nv2kob8f - 3. └ structural type Foo#089vmor9c5 - - 4. Foo.Foo#089vmor9c5#0 : 'Foo#089vmor9c5 - ↓ - 5. ┌ Foo.Foo#00nv2kob8f#0 : () - 6. └ Foo.Foo#089vmor9c5#0 : 'Foo#089vmor9c5 - - Tip: You can use `todo` to see if this generated any work to - do in this namespace and `test` to run the tests. Or you - can use `undo` or `reflog` to undo the results of this - merge. + Done. - Applying changes from patch... - -``` -```ucm .> delete.verbose a.Foo Removed definitions: @@ -190,26 +127,17 @@ structural type Foo = Foo Name changes: Original Changes - 2. b.Foo ┐ 3. a.Foo#00nv2kob8f (removed) + 2. a.Bar ┐ 3. a.Foo#00nv2kob8f (removed) 4. builtin.Unit │ 5. a.Foo#00nv2kob8f ┘ Tip: You can use `undo` or `reflog` to undo this change. -``` -```ucm .> delete.verbose a.Foo.Foo Removed definitions: - 1. a.Foo.Foo#089vmor9c5#0 : '#089vmor9c5 - - Name changes: - - Original Changes - 2. b.Foo.Foo ┐ 3. a.Foo.Foo#00nv2kob8f#0 (removed) - 4. builtin.Unit.Unit │ - 5. a.Foo.Foo#00nv2kob8f#0 ┘ + 1. a.Foo.Foo : '#089vmor9c5 Tip: You can use `undo` or `reflog` to undo this change. @@ -229,8 +157,6 @@ structural type foo = Foo () structural type foo foo : Nat -``` -```ucm .> delete.verbose foo Removed definitions: @@ -354,7 +280,7 @@ d = a + b + c a : Nat b : Nat - (also named b.foo) + (also named a.bar) c : Nat d : Nat From 831c2e0e06517260e94d933fb853ebd398c9c453 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Thu, 27 Jun 2024 11:30:17 -0400 Subject: [PATCH 2/4] in diff-namespace.md, replace uses of merge.old with debug.alias.term.force --- unison-src/transcripts/diff-namespace.md | 40 ++--- .../transcripts/diff-namespace.output.md | 138 ++++-------------- 2 files changed, 51 insertions(+), 127 deletions(-) diff --git a/unison-src/transcripts/diff-namespace.md b/unison-src/transcripts/diff-namespace.md index 7db0bc898a..4d04dda791 100644 --- a/unison-src/transcripts/diff-namespace.md +++ b/unison-src/transcripts/diff-namespace.md @@ -3,23 +3,19 @@ ``` ```unison:hide -x = 23 +b1.x = 23 +b1.fslkdjflskdjflksjdf = 663 +b2.x = 23 +b2.fslkdjflskdjflksjdf = 23 +b2.abc = 23 ``` ```ucm -.b1> add -.b1> alias.term x fslkdjflskdjflksjdf -.> fork b1 b2 -.b2> alias.term x abc -``` - -```unison:hide -fslkdjflskdjflksjdf = 663 +.> add +.> debug.alias.term.force b1.x b1.fslkdjflskdjflksjdf ``` ```ucm -.b0> add -.> merge.old b0 b1 .> diff.namespace b1 b2 .b2> diff.namespace .b1 ``` @@ -63,12 +59,13 @@ Here's what we've done so far: ``` ```unison:hide -fromJust = "asldkfjasldkfj" +junk = "asldkfjasldkfj" ``` ```ucm -.ns1b> add -.> merge.old ns1b ns1 +.ns1> add +.ns1> debug.alias.term.force junk fromJust +.ns1> delete.term junk ``` ```unison:hide @@ -104,33 +101,40 @@ bdependent = "banana" ## Two different auto-propagated changes creating a name conflict + Currently, the auto-propagated name-conflicted definitions are not explicitly shown, only their also-conflicted dependency is shown. + ```unison:hide a = 333 b = a + 1 ``` + ```ucm .nsx> add .> fork nsx nsy .> fork nsx nsz ``` + ```unison:hide a = 444 ``` + ```ucm .nsy> update.old ``` + ```unison:hide a = 555 ``` + ```ucm .nsz> update.old -.> merge.old nsy nsw -``` -```ucm:error -.> merge.old nsz nsw +.> fork nsy nsw +.> debug.alias.term.force nsz.a nsw.a +.> debug.alias.term.force nsz.b nsw.b ``` + ```ucm .> diff.namespace nsx nsw .nsw> view a b diff --git a/unison-src/transcripts/diff-namespace.output.md b/unison-src/transcripts/diff-namespace.output.md index cacb9d1fc4..490fb3fa2c 100644 --- a/unison-src/transcripts/diff-namespace.output.md +++ b/unison-src/transcripts/diff-namespace.output.md @@ -1,60 +1,28 @@ ```unison -x = 23 +b1.x = 23 +b1.fslkdjflskdjflksjdf = 663 +b2.x = 23 +b2.fslkdjflskdjflksjdf = 23 +b2.abc = 23 ``` ```ucm - ☝️ The namespace .b1 is empty. - -.b1> add +.> add ⍟ I've added these definitions: - x : ##Nat - -.b1> alias.term x fslkdjflskdjflksjdf - - Done. - -.> fork b1 b2 - - Done. + b1.fslkdjflskdjflksjdf : Nat + b1.x : Nat + b2.abc : Nat + b2.fslkdjflskdjflksjdf : Nat + b2.x : Nat -.b2> alias.term x abc +.> debug.alias.term.force b1.x b1.fslkdjflskdjflksjdf Done. ``` -```unison -fslkdjflskdjflksjdf = 663 -``` - ```ucm - ☝️ The namespace .b0 is empty. - -.b0> add - - ⍟ I've added these definitions: - - fslkdjflskdjflksjdf : ##Nat - -.> merge.old b0 b1 - - Here's what's changed in b1 after the merge: - - New name conflicts: - - 1. fslkdjflskdjflksjdf#u520d1t9kc : Nat - ↓ - 2. ┌ fslkdjflskdjflksjdf#sekb3fdsvb : Nat - 3. └ fslkdjflskdjflksjdf#u520d1t9kc : Nat - - Tip: You can use `todo` to see if this generated any work to - do in this namespace and `test` to run the tests. Or you - can use `undo` or `reflog` to undo the results of this - merge. - - Applying changes from patch... - .> diff.namespace b1 b2 Resolved name conflicts: @@ -155,35 +123,23 @@ Here's what we've done so far: ``` ```unison -fromJust = "asldkfjasldkfj" +junk = "asldkfjasldkfj" ``` ```ucm - ☝️ The namespace .ns1b is empty. - -.ns1b> add +.ns1> add ⍟ I've added these definitions: - fromJust : ##Text + junk : ##Text -.> merge.old ns1b ns1 +.ns1> debug.alias.term.force junk fromJust - Here's what's changed in ns1 after the merge: - - New name conflicts: - - 1. fromJust#gjmq673r1v : Nat - ↓ - 2. ┌ fromJust#gjmq673r1v : Nat - 3. └ fromJust#rnbo52q2sh : Text - - Tip: You can use `todo` to see if this generated any work to - do in this namespace and `test` to run the tests. Or you - can use `undo` or `reflog` to undo the results of this - merge. + Done. - Applying changes from patch... +.ns1> delete.term junk + + Done. ``` ```unison @@ -356,8 +312,10 @@ bdependent = "banana" ``` ## Two different auto-propagated changes creating a name conflict + Currently, the auto-propagated name-conflicted definitions are not explicitly shown, only their also-conflicted dependency is shown. + ```unison a = 333 b = a + 1 @@ -405,55 +363,17 @@ a = 555 a : ##Nat -.> merge.old nsy nsw - - Here's what's changed in nsw after the merge: - - Added definitions: - - 1. a : Nat - 2. b : Nat - - 3. patch patch (added 1 updates) - - Tip: You can use `todo` to see if this generated any work to - do in this namespace and `test` to run the tests. Or you - can use `undo` or `reflog` to undo the results of this - merge. +.> fork nsy nsw - Applying changes from patch... + Done. -``` -```ucm -.> merge.old nsz nsw +.> debug.alias.term.force nsz.a nsw.a - Here's what's changed in nsw after the merge: - - New name conflicts: - - 1. a#mdl4vqtu00 : Nat - ↓ - 2. ┌ a#mdl4vqtu00 : Nat - 3. └ a#vrs8gtkl2t : Nat - - 4. b#unkqhuu66p : Nat - ↓ - 5. ┌ b#aapqletas7 : Nat - 6. └ b#unkqhuu66p : Nat - - Updates: - - 7. patch patch (added 1 updates) - - Tip: You can use `todo` to see if this generated any work to - do in this namespace and `test` to run the tests. Or you - can use `undo` or `reflog` to undo the results of this - merge. + Done. - Applying changes from patch... +.> debug.alias.term.force nsz.b nsw.b - I tried to auto-apply the patch, but couldn't because it - contained contradictory entries. + Done. ``` ```ucm @@ -473,7 +393,7 @@ a = 555 Added definitions: - 7. patch patch (added 2 updates) + 7. patch patch (added 1 updates) .nsw> view a b From d9618f7ab306de148eeb8012c7ac03fe3c4bca75 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Thu, 27 Jun 2024 11:41:25 -0400 Subject: [PATCH 3/4] in name-selection.md, replace use of merge.old with debug.alias.term.force --- unison-src/transcripts/name-selection.md | 46 ++++---- .../transcripts/name-selection.output.md | 105 +++++++----------- 2 files changed, 63 insertions(+), 88 deletions(-) diff --git a/unison-src/transcripts/name-selection.md b/unison-src/transcripts/name-selection.md index 992ee79491..cff6c15d4f 100644 --- a/unison-src/transcripts/name-selection.md +++ b/unison-src/transcripts/name-selection.md @@ -12,46 +12,40 @@ This transcript shows how the pretty-printer picks names for a hash when multipl ``` ```unison:hide -a = b + 1 -b = 0 + 1 +a.a = a.b + 1 +a.b = 0 + 1 +a.aaa.but.more.segments = 0 + 1 ``` Will add `a` and `b` to the codebase and give `b` a longer (in terms of segment length alias), and show that it isn't used when viewing `a`: ```ucm -.a> add -.a> alias.term b aaa.but.more.segments +.> add .a> view a ``` Next let's introduce a conflicting symbol and show that its hash qualified name isn't used when it has an unconflicted name: -``` -.> fork a a2 -.> fork a a3 -``` - -```unison:hide -c = 1 -d = c + 10 -``` - -```ucm:hide -.a2> builtins.merge -``` -```ucm -.a2> add -.a2> alias.term c long.name.but.shortest.suffixification -``` - ```unison:hide -c = 2 -d = c + 10 +a2.a = a2.b + 1 +a2.b = 0 + 1 +a2.aaa.but.more.segments = 0 + 1 +a2.c = 1 +a2.d = a2.c + 10 +a2.long.name.but.shortest.suffixification = 1 + +a3.a = a3.b + 1 +a3.b = 0 + 1 +a3.aaa.but.more.segments = 0 + 1 +a3.c = 2 +a3.d = a3.c + 10 +a3.long.name.but.shortest.suffixification = 1 ``` ```ucm -.a3> add -.a3> merge.old .a2 .a3 +.> add +.> debug.alias.term.force a2.c a3.c +.> debug.alias.term.force a2.d a3.d ``` At this point, `a3` is conflicted for symbols `c` and `d`, so those are deprioritized. diff --git a/unison-src/transcripts/name-selection.output.md b/unison-src/transcripts/name-selection.output.md index e124c18a20..a9b3d9679f 100644 --- a/unison-src/transcripts/name-selection.output.md +++ b/unison-src/transcripts/name-selection.output.md @@ -5,23 +5,21 @@ This transcript shows how the pretty-printer picks names for a hash when multipl 3. Otherwise if there are multiple names with a minimal number of segments, compare the names alphabetically. ```unison -a = b + 1 -b = 0 + 1 +a.a = a.b + 1 +a.b = 0 + 1 +a.aaa.but.more.segments = 0 + 1 ``` Will add `a` and `b` to the codebase and give `b` a longer (in terms of segment length alias), and show that it isn't used when viewing `a`: ```ucm -.a> add +.> add ⍟ I've added these definitions: - a : Nat - b : Nat - -.a> alias.term b aaa.but.more.segments - - Done. + a.a : Nat + a.aaa.but.more.segments : Nat + a.b : Nat .a> view a @@ -33,70 +31,53 @@ Will add `a` and `b` to the codebase and give `b` a longer (in terms of segment ``` Next let's introduce a conflicting symbol and show that its hash qualified name isn't used when it has an unconflicted name: -``` -.> fork a a2 -.> fork a a3 - -``` - ```unison -c = 1 -d = c + 10 +a2.a = a2.b + 1 +a2.b = 0 + 1 +a2.aaa.but.more.segments = 0 + 1 +a2.c = 1 +a2.d = a2.c + 10 +a2.long.name.but.shortest.suffixification = 1 + +a3.a = a3.b + 1 +a3.b = 0 + 1 +a3.aaa.but.more.segments = 0 + 1 +a3.c = 2 +a3.d = a3.c + 10 +a3.long.name.but.shortest.suffixification = 1 ``` ```ucm -.a2> add +.> add ⍟ I've added these definitions: - c : Nat - d : Nat - -.a2> alias.term c long.name.but.shortest.suffixification + a2.a : Nat + (also named a.a) + a2.aaa.but.more.segments : Nat + (also named a.b and a.aaa.but.more.segments) + a2.b : Nat + (also named a.b and a.aaa.but.more.segments) + a2.c : Nat + a2.d : Nat + a2.long.name.but.shortest.suffixification : Nat + a3.a : Nat + (also named a.a) + a3.aaa.but.more.segments : Nat + (also named a.b and a.aaa.but.more.segments) + a3.b : Nat + (also named a.b and a.aaa.but.more.segments) + a3.c : Nat + a3.d : Nat + a3.long.name.but.shortest.suffixification : Nat + +.> debug.alias.term.force a2.c a3.c Done. -``` -```unison -c = 2 -d = c + 10 -``` - -```ucm -.a3> add +.> debug.alias.term.force a2.d a3.d - ⍟ I've added these definitions: - - c : Nat - d : Nat - -.a3> merge.old .a2 .a3 - - Here's what's changed in .a3 after the merge: - - New name conflicts: - - 1. c#dcgdua2lj6 : Nat - ↓ - 2. ┌ c#dcgdua2lj6 : Nat - 3. └ c#gjmq673r1v : Nat - - 4. d#9ivhgvhthc : Nat - ↓ - 5. ┌ d#9ivhgvhthc : Nat - 6. └ d#ve16e6jmf6 : Nat - - Added definitions: - - 7. ┌ c#gjmq673r1v : Nat - 8. └ long.name.but.shortest.suffixification : Nat - - Tip: You can use `todo` to see if this generated any work to - do in this namespace and `test` to run the tests. Or you - can use `undo` or `reflog` to undo the results of this - merge. - - Applying changes from patch... + Done. ``` At this point, `a3` is conflicted for symbols `c` and `d`, so those are deprioritized. From d1f2d7863836815c8546c737d434fa5ff5f529d2 Mon Sep 17 00:00:00 2001 From: Mitchell Rosen Date: Thu, 27 Jun 2024 11:44:46 -0400 Subject: [PATCH 4/4] in update-on-conflict.md, replace use of merge.old with debug.alias.term.force --- unison-src/transcripts/update-on-conflict.md | 16 ++--- .../transcripts/update-on-conflict.output.md | 59 ++++++------------- 2 files changed, 26 insertions(+), 49 deletions(-) diff --git a/unison-src/transcripts/update-on-conflict.md b/unison-src/transcripts/update-on-conflict.md index 21b9a656cb..73a699cafb 100644 --- a/unison-src/transcripts/update-on-conflict.md +++ b/unison-src/transcripts/update-on-conflict.md @@ -1,28 +1,28 @@ # Update on conflict +Updating conflicted definitions works fine. + ```ucm:hide .> builtins.merge .merged> builtins.merge ``` ```unison -a.x = 1 -b.x = 2 +x = 1 +temp = 2 ``` -Cause a conflict: ```ucm .> add -.merged> merge.old .a -.merged> merge.old .b +.> debug.alias.term.force temp x +.> delete.term temp ``` -Updating conflicted definitions works fine. - ```unison x = 3 ``` ```ucm -.merged> update +.> update +.> view x ``` diff --git a/unison-src/transcripts/update-on-conflict.output.md b/unison-src/transcripts/update-on-conflict.output.md index 6a9afd2e93..f5e8e484f6 100644 --- a/unison-src/transcripts/update-on-conflict.output.md +++ b/unison-src/transcripts/update-on-conflict.output.md @@ -1,8 +1,10 @@ # Update on conflict +Updating conflicted definitions works fine. + ```unison -a.x = 1 -b.x = 2 +x = 1 +temp = 2 ``` ```ucm @@ -15,57 +17,27 @@ b.x = 2 ⍟ These new definitions are ok to `add`: - a.x : Nat - b.x : Nat + temp : Nat + x : Nat ``` -Cause a conflict: ```ucm .> add ⍟ I've added these definitions: - a.x : Nat - b.x : Nat - -.merged> merge.old .a - - Here's what's changed in the current namespace after the - merge: - - Added definitions: - - 1. x : Nat - - Tip: You can use `todo` to see if this generated any work to - do in this namespace and `test` to run the tests. Or you - can use `undo` or `reflog` to undo the results of this - merge. + temp : Nat + x : Nat - Applying changes from patch... +.> debug.alias.term.force temp x -.merged> merge.old .b + Done. - Here's what's changed in the current namespace after the - merge: - - New name conflicts: - - 1. x#gjmq673r1v : Nat - ↓ - 2. ┌ x#dcgdua2lj6 : Nat - 3. └ x#gjmq673r1v : Nat - - Tip: You can use `todo` to see if this generated any work to - do in this namespace and `test` to run the tests. Or you - can use `undo` or `reflog` to undo the results of this - merge. +.> delete.term temp - Applying changes from patch... + Done. ``` -Updating conflicted definitions works fine. - ```unison x = 3 ``` @@ -85,11 +57,16 @@ x = 3 ``` ```ucm -.merged> update +.> update Okay, I'm searching the branch for code that needs to be updated... Done. +.> view x + + x : Nat + x = 3 + ```