From 67cc18b26cc922667a1694361a91190c6fb8efe5 Mon Sep 17 00:00:00 2001 From: James Sully Date: Sat, 7 Aug 2021 18:29:51 +1000 Subject: [PATCH 1/4] Add single argument form of diff.namespace --- .../src/Unison/CommandLine/InputPatterns.hs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/CommandLine/InputPatterns.hs b/parser-typechecker/src/Unison/CommandLine/InputPatterns.hs index b27f2b32fe..bd7355c74c 100644 --- a/parser-typechecker/src/Unison/CommandLine/InputPatterns.hs +++ b/parser-typechecker/src/Unison/CommandLine/InputPatterns.hs @@ -926,12 +926,16 @@ diffNamespace :: InputPattern diffNamespace = InputPattern "diff.namespace" [] - [(Required, pathArg), (Required, pathArg)] + [(Required, pathArg), (Optional, pathArg)] (P.column2 [ ( "`diff.namespace before after`" , P.wrap "shows how the namespace `after` differs from the namespace `before`" ) + , ( "`diff.namespace before`" + , P.wrap + "shows how the namespace `before` differs from the current namespace" + ) ] ) (\case @@ -939,6 +943,9 @@ diffNamespace = InputPattern before <- Path.parsePath' before after <- Path.parsePath' after pure $ Input.DiffNamespaceI before after + [before] -> first fromString $ do + before <- Path.parsePath' before + pure $ Input.DiffNamespaceI before Path.currentPath _ -> Left $ I.help diffNamespace ) From 4c01d26aba58529a44d0560fffe8b898809a58f0 Mon Sep 17 00:00:00 2001 From: James Sully Date: Mon, 9 Aug 2021 15:40:07 +1000 Subject: [PATCH 2/4] Reword diff.namespace help text for consistency --- parser-typechecker/src/Unison/CommandLine/InputPatterns.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parser-typechecker/src/Unison/CommandLine/InputPatterns.hs b/parser-typechecker/src/Unison/CommandLine/InputPatterns.hs index bd7355c74c..05127aa007 100644 --- a/parser-typechecker/src/Unison/CommandLine/InputPatterns.hs +++ b/parser-typechecker/src/Unison/CommandLine/InputPatterns.hs @@ -934,7 +934,7 @@ diffNamespace = InputPattern ) , ( "`diff.namespace before`" , P.wrap - "shows how the namespace `before` differs from the current namespace" + "shows how the current namespace differs from the namespace `before`" ) ] ) From 36719e6dac6086afb49302a273edd2d197afcc5a Mon Sep 17 00:00:00 2001 From: James Sully Date: Mon, 9 Aug 2021 17:00:00 +1000 Subject: [PATCH 3/4] Add a failing test for single argument form of diff.namespace The output for ``` .b2> diff.namespace .b1 ``` should be the same as the output for ``` .> diff.namespace b1 b2 ``` What the heck? --- unison-src/transcripts/diff.md | 1 + unison-src/transcripts/diff.output.md | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/unison-src/transcripts/diff.md b/unison-src/transcripts/diff.md index 9183a695f8..e76b53384a 100644 --- a/unison-src/transcripts/diff.md +++ b/unison-src/transcripts/diff.md @@ -19,6 +19,7 @@ fslkdjflskdjflksjdf = 663 .b0> add .> merge b0 b1 .> diff.namespace b1 b2 +.b2> diff.namespace b1 ``` Things we want to test: diff --git a/unison-src/transcripts/diff.output.md b/unison-src/transcripts/diff.output.md index 6d9d7519f6..31edc3f44e 100644 --- a/unison-src/transcripts/diff.output.md +++ b/unison-src/transcripts/diff.output.md @@ -69,6 +69,14 @@ fslkdjflskdjflksjdf = 663 6. fslkdjflskdjflksjdf#4kipsv2tm6 ┘ 7. fslkdjflskdjflksjdf (added) 8. fslkdjflskdjflksjdf#4kipsv2tm6 (removed) +.b2> diff.namespace b1 + + Added definitions: + + 1. ┌ abc : Nat + 2. │ fslkdjflskdjflksjdf : Nat + 3. └ x : Nat + ``` Things we want to test: From 9a9f94f96c4d3ca9bd3999b823d1aadb9208e0c3 Mon Sep 17 00:00:00 2001 From: James Sully Date: Mon, 9 Aug 2021 18:06:43 +1000 Subject: [PATCH 4/4] Add single '.' to diff.namespace test that I just spent too long debugging --- unison-src/transcripts/diff.md | 2 +- unison-src/transcripts/diff.output.md | 18 +++++++++++++----- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/unison-src/transcripts/diff.md b/unison-src/transcripts/diff.md index e76b53384a..5846af90c1 100644 --- a/unison-src/transcripts/diff.md +++ b/unison-src/transcripts/diff.md @@ -19,7 +19,7 @@ fslkdjflskdjflksjdf = 663 .b0> add .> merge b0 b1 .> diff.namespace b1 b2 -.b2> diff.namespace b1 +.b2> diff.namespace .b1 ``` Things we want to test: diff --git a/unison-src/transcripts/diff.output.md b/unison-src/transcripts/diff.output.md index 31edc3f44e..cda20f1fcb 100644 --- a/unison-src/transcripts/diff.output.md +++ b/unison-src/transcripts/diff.output.md @@ -69,13 +69,21 @@ fslkdjflskdjflksjdf = 663 6. fslkdjflskdjflksjdf#4kipsv2tm6 ┘ 7. fslkdjflskdjflksjdf (added) 8. fslkdjflskdjflksjdf#4kipsv2tm6 (removed) -.b2> diff.namespace b1 +.b2> diff.namespace .b1 - Added definitions: + Resolved name conflicts: + + 1. ┌ fslkdjflskdjflksjdf#4kipsv2tm6 : Nat + 2. └ fslkdjflskdjflksjdf#s5tu4n7rlb : Nat + ↓ + 3. fslkdjflskdjflksjdf#4kipsv2tm6 : Nat - 1. ┌ abc : Nat - 2. │ fslkdjflskdjflksjdf : Nat - 3. └ x : Nat + Name changes: + + Original Changes + 4. x ┐ 5. abc (added) + 6. fslkdjflskdjflksjdf#4kipsv2tm6 ┘ 7. fslkdjflskdjflksjdf (added) + 8. fslkdjflskdjflksjdf#4kipsv2tm6 (removed) ``` Things we want to test: