mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-23 08:18:04 +03:00
finish up the various ShowDiff* outputs
This commit is contained in:
parent
f9c21dfe33
commit
19181bf2bb
@ -402,7 +402,7 @@ loop = do
|
|||||||
stepManyAt (makeDeleteTermNames ++ makeDeleteTypeNames)
|
stepManyAt (makeDeleteTermNames ++ makeDeleteTypeNames)
|
||||||
root'' <- use root
|
root'' <- use root
|
||||||
diffHelper (Branch.head root') (Branch.head root'') >>=
|
diffHelper (Branch.head root') (Branch.head root'') >>=
|
||||||
respondNumbered . uncurry ShowDiffAfterDelete
|
respondNumbered . uncurry ShowDiffAfterDeleteDefinitions
|
||||||
else do
|
else do
|
||||||
failed <-
|
failed <-
|
||||||
loadSearchResults $ SR.fromNames failed
|
loadSearchResults $ SR.fromNames failed
|
||||||
@ -481,7 +481,7 @@ loop = do
|
|||||||
b <- updateAtM dest $ const (pure merged)
|
b <- updateAtM dest $ const (pure merged)
|
||||||
if b then do
|
if b then do
|
||||||
diffHelper (Branch.head destb) (Branch.head merged) >>=
|
diffHelper (Branch.head destb) (Branch.head merged) >>=
|
||||||
respondNumbered . uncurry (ShowDiffAfterMerge dest)
|
respondNumbered . uncurry (ShowDiffAfterMerge dest0 dest)
|
||||||
patch <- getPatchAt defaultPatchPath
|
patch <- getPatchAt defaultPatchPath
|
||||||
void $ propagatePatch inputDescription patch dest
|
void $ propagatePatch inputDescription patch dest
|
||||||
else respond (NothingTodo input)
|
else respond (NothingTodo input)
|
||||||
@ -496,7 +496,7 @@ loop = do
|
|||||||
if merged == destb then respond (NothingTodo input)
|
if merged == destb then respond (NothingTodo input)
|
||||||
else
|
else
|
||||||
diffHelper (Branch.head destb) (Branch.head merged) >>=
|
diffHelper (Branch.head destb) (Branch.head merged) >>=
|
||||||
respondNumbered . uncurry (ShowDiffAfterMergePreview dest)
|
respondNumbered . uncurry (ShowDiffAfterMergePreview dest0 dest)
|
||||||
|
|
||||||
DiffNamespaceI before0 after0 -> do
|
DiffNamespaceI before0 after0 -> do
|
||||||
let [beforep, afterp] =
|
let [beforep, afterp] =
|
||||||
@ -578,7 +578,10 @@ loop = do
|
|||||||
(Path.toName' (Path.unsplit' p))
|
(Path.toName' (Path.unsplit' p))
|
||||||
(Branch.toNames0 b)
|
(Branch.toNames0 b)
|
||||||
diff = Names3.diff0 deletedNames mempty
|
diff = Names3.diff0 deletedNames mempty
|
||||||
respond $ ShowDiff input diff
|
diffHelper b Branch.empty0 >>=
|
||||||
|
respondNumbered
|
||||||
|
. uncurry (ShowDiffAfterDeleteBranch
|
||||||
|
$ resolveToAbsolute (Path.unsplit' p))
|
||||||
else do
|
else do
|
||||||
failed <- loadSearchResults $ SR.fromNames failed
|
failed <- loadSearchResults $ SR.fromNames failed
|
||||||
failedDependents <- loadSearchResults $ SR.fromNames failedDependents
|
failedDependents <- loadSearchResults $ SR.fromNames failedDependents
|
||||||
@ -1322,7 +1325,7 @@ loop = do
|
|||||||
let destAbs = Path.toAbsolutePath currentPath' path
|
let destAbs = Path.toAbsolutePath currentPath' path
|
||||||
resolveConfiguredGitUrl Pull path mayRepo >>= \case
|
resolveConfiguredGitUrl Pull path mayRepo >>= \case
|
||||||
Left e -> eval . Notify $ e
|
Left e -> eval . Notify $ e
|
||||||
Right ns -> loadRemoteBranchAt input inputDescription ns destAbs
|
Right ns -> pullRemoteBranchAt path input inputDescription ns destAbs
|
||||||
|
|
||||||
PushRemoteBranchI mayRepo path -> do
|
PushRemoteBranchI mayRepo path -> do
|
||||||
let srcAbs = Path.toAbsolutePath currentPath' path
|
let srcAbs = Path.toAbsolutePath currentPath' path
|
||||||
@ -1730,15 +1733,16 @@ respondNumbered output = do
|
|||||||
|
|
||||||
-- Merges the specified remote branch into the specified local absolute path.
|
-- Merges the specified remote branch into the specified local absolute path.
|
||||||
-- Implementation detail of PullRemoteBranchI
|
-- Implementation detail of PullRemoteBranchI
|
||||||
loadRemoteBranchAt
|
pullRemoteBranchAt
|
||||||
:: Var v
|
:: Var v
|
||||||
=> Monad m
|
=> Monad m
|
||||||
=> Input
|
=> Path.Path'
|
||||||
|
-> Input
|
||||||
-> Text
|
-> Text
|
||||||
-> (RemoteRepo, Maybe ShortBranchHash, Path)
|
-> (RemoteRepo, Maybe ShortBranchHash, Path)
|
||||||
-> Path.Absolute
|
-> Path.Absolute
|
||||||
-> Action' m v ()
|
-> Action' m v ()
|
||||||
loadRemoteBranchAt input inputDescription (repo, sbh, remotePath) p = do
|
pullRemoteBranchAt p' input inputDescription (repo, sbh, remotePath) p = do
|
||||||
b <- eval $ maybe (LoadRemoteRootBranch FailIfMissing repo)
|
b <- eval $ maybe (LoadRemoteRootBranch FailIfMissing repo)
|
||||||
(LoadRemoteShortBranch repo) sbh
|
(LoadRemoteShortBranch repo) sbh
|
||||||
case b of
|
case b of
|
||||||
@ -1755,7 +1759,7 @@ loadRemoteBranchAt input inputDescription (repo, sbh, remotePath) p = do
|
|||||||
doMerge b b0 = do
|
doMerge b b0 = do
|
||||||
merged <- eval . Eval $ Branch.merge b b0
|
merged <- eval . Eval $ Branch.merge b b0
|
||||||
diffHelper (Branch.head b0) (Branch.head merged) >>=
|
diffHelper (Branch.head b0) (Branch.head merged) >>=
|
||||||
respondNumbered . uncurry ShowDiffAfterPull
|
respondNumbered . uncurry (ShowDiffAfterPull p' p)
|
||||||
pure merged
|
pure merged
|
||||||
|
|
||||||
syncRemoteRootBranch
|
syncRemoteRootBranch
|
||||||
|
@ -71,12 +71,13 @@ pushPull push pull p = case p of
|
|||||||
|
|
||||||
data NumberedOutput v
|
data NumberedOutput v
|
||||||
= ShowDiffNamespace Path.Absolute Path.Absolute PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
= ShowDiffNamespace Path.Absolute Path.Absolute PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
||||||
| ShowDiffAfterDelete PPE.PrettyPrintEnv (BranchDiffOutput v Ann) -- path is Path.absoluteEmpty
|
|
||||||
| ShowDiffAfterMerge Path.Absolute PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
|
||||||
| ShowDiffAfterMergePreview Path.Absolute PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
|
||||||
| ShowDiffAfterUndo PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
| ShowDiffAfterUndo PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
||||||
| ShowDiffAfterPull PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
| ShowDiffAfterDeleteDefinitions PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
||||||
|
| ShowDiffAfterDeleteBranch Path.Absolute PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
||||||
|
| ShowDiffAfterMerge Path.Path' Path.Absolute PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
||||||
|
| ShowDiffAfterMergePreview Path.Path' Path.Absolute PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
||||||
|
| ShowDiffAfterPull Path.Path' Path.Absolute PPE.PrettyPrintEnv (BranchDiffOutput v Ann)
|
||||||
|
|
||||||
-- | ShowDiff
|
-- | ShowDiff
|
||||||
|
|
||||||
data Output v
|
data Output v
|
||||||
@ -311,4 +312,11 @@ isFailure o = case o of
|
|||||||
isNumberedFailure :: NumberedOutput v -> Bool
|
isNumberedFailure :: NumberedOutput v -> Bool
|
||||||
isNumberedFailure = \case
|
isNumberedFailure = \case
|
||||||
ShowDiffNamespace{} -> False
|
ShowDiffNamespace{} -> False
|
||||||
|
ShowDiffAfterDeleteDefinitions{} -> False
|
||||||
|
ShowDiffAfterDeleteBranch{} -> False
|
||||||
|
ShowDiffAfterMerge{} -> False
|
||||||
|
ShowDiffAfterMergePreview{} -> False
|
||||||
|
ShowDiffAfterUndo{} -> False
|
||||||
|
ShowDiffAfterPull{} -> False
|
||||||
|
|
||||||
|
|
||||||
|
@ -128,8 +128,60 @@ renderFileName dir = P.group . P.blue . fromString <$> shortenDirectory dir
|
|||||||
|
|
||||||
notifyNumbered :: Var v => NumberedOutput v -> (Pretty, NumberedArgs)
|
notifyNumbered :: Var v => NumberedOutput v -> (Pretty, NumberedArgs)
|
||||||
notifyNumbered o = case o of
|
notifyNumbered o = case o of
|
||||||
ShowDiffNamespace oldPath rightPath ppe diffOutput ->
|
ShowDiffNamespace oldPrefix newPrefix ppe diffOutput ->
|
||||||
showDiffNamespace ppe oldPath rightPath diffOutput
|
showDiffNamespace ppe oldPrefix newPrefix diffOutput
|
||||||
|
|
||||||
|
ShowDiffAfterDeleteDefinitions ppe diff ->
|
||||||
|
first (\p -> P.lines
|
||||||
|
[ p
|
||||||
|
, ""
|
||||||
|
, undoTip
|
||||||
|
]) (showDiffNamespace ppe e e diff)
|
||||||
|
|
||||||
|
ShowDiffAfterDeleteBranch bAbs ppe diff ->
|
||||||
|
first (\p -> P.lines
|
||||||
|
[ p
|
||||||
|
, ""
|
||||||
|
, undoTip
|
||||||
|
]) (showDiffNamespace ppe bAbs bAbs diff)
|
||||||
|
|
||||||
|
ShowDiffAfterMerge dest' destAbs ppe diffOutput ->
|
||||||
|
first (\p -> P.lines [
|
||||||
|
P.wrap $ "Here's the changed in " <> prettyPath' dest' <> "after the merge:"
|
||||||
|
, ""
|
||||||
|
, p
|
||||||
|
, ""
|
||||||
|
, tip $ "You can use " <> IP.makeExample' IP.todo
|
||||||
|
<> "to see if this generated any work to do in this branch"
|
||||||
|
<> "and " <> IP.makeExample' IP.test <> "to run the tests."
|
||||||
|
<> "You can always" <> IP.makeExample' IP.undo <> "to undo the results of this merge."
|
||||||
|
]) (showDiffNamespace ppe destAbs destAbs diffOutput)
|
||||||
|
|
||||||
|
ShowDiffAfterMergePreview dest' destAbs ppe diffOutput ->
|
||||||
|
first (\p -> P.lines [
|
||||||
|
P.wrap $ "Here's what would change in " <> prettyPath' dest' <> "after the merge:"
|
||||||
|
, ""
|
||||||
|
, p
|
||||||
|
]) (showDiffNamespace ppe destAbs destAbs diffOutput)
|
||||||
|
|
||||||
|
ShowDiffAfterUndo ppe diffOutput ->
|
||||||
|
first (\p -> P.lines ["Here's the changes I undid", "", p ])
|
||||||
|
(showDiffNamespace ppe e e diffOutput)
|
||||||
|
|
||||||
|
ShowDiffAfterPull dest' destAbs ppe diff ->
|
||||||
|
if OBD.isEmpty diff then
|
||||||
|
("✅ Looks like " <> prettyPath' dest' <> " is up to date.", mempty)
|
||||||
|
else
|
||||||
|
first (\p -> P.lines $ [
|
||||||
|
P.wrap $ "Here's what's changed in " <> prettyPath' dest' <> "after the pull:", "",
|
||||||
|
p, "",
|
||||||
|
undoTip
|
||||||
|
])
|
||||||
|
(showDiffNamespace ppe destAbs destAbs diff)
|
||||||
|
where e = Path.absoluteEmpty
|
||||||
|
undoTip = tip $ "You can always" <> IP.makeExample' IP.undo
|
||||||
|
<> "if this wasn't what you wanted."
|
||||||
|
|
||||||
|
|
||||||
notifyUser :: forall v . Var v => FilePath -> Output v -> IO Pretty
|
notifyUser :: forall v . Var v => FilePath -> Output v -> IO Pretty
|
||||||
notifyUser dir o = case o of
|
notifyUser dir o = case o of
|
||||||
|
@ -66,15 +66,37 @@ unique type Y a b = Y a b
|
|||||||
.> delete.term ns2.fromJust'
|
.> delete.term ns2.fromJust'
|
||||||
.> diff.namespace ns1 ns2
|
.> diff.namespace ns1 ns2
|
||||||
.> diff.namespace ns2 nsempty
|
.> diff.namespace ns2 nsempty
|
||||||
|
.> delete.namespace ns2
|
||||||
```
|
```
|
||||||
|
|
||||||
## Display issues to fixup
|
## Display issues to fixup
|
||||||
|
- [ ] delete.term has some bonkers output
|
||||||
|
.> delete.term ns2.fromJust'
|
||||||
|
|
||||||
|
Here's what I deleted:
|
||||||
|
|
||||||
|
Updates:
|
||||||
|
|
||||||
|
1. ns1.fromJust#hs2i9lcgkd : Text
|
||||||
|
2. ns1.fromJust#jk19sm5bf8 : Nat
|
||||||
|
|
||||||
|
3. ns2.fromJust' : Nat
|
||||||
|
- 4. ns1.b : Nat
|
||||||
|
|
||||||
|
Name changes: -- this is ok vvv
|
||||||
|
|
||||||
|
Original Changes
|
||||||
|
5. ns2.fromJust ┐ 6. ns2.fromJust' (removed)
|
||||||
|
7. ns2.fromJust' ┘
|
||||||
|
|
||||||
|
Tip: You can always `undo` if this wasn't what you wanted.
|
||||||
|
|
||||||
- [ ] Things look screwy when the type signature doesn't fit and has to get broken
|
- [ ] Things look screwy when the type signature doesn't fit and has to get broken
|
||||||
up into multiple lines. Maybe just disallow that?
|
up into multiple lines. Maybe just disallow that?
|
||||||
- [ ] add tagging of propagated updates to test propagated updates output
|
- [ ] add tagging of propagated updates to test propagated updates output
|
||||||
- [ ] Delete blank line in between copies / renames entries if all entries are 1 to 1
|
- [ ] Delete blank line in between copies / renames entries if all entries are 1 to 1
|
||||||
see todo in the code
|
see todo in the code
|
||||||
- [ ] Maybe group and/or add headings to the types, constructors, terms
|
- [ ] ~~Maybe group and/or add headings to the types, constructors, terms~~
|
||||||
- [x] Make a decision about how we want to show constructors in the diff
|
- [x] Make a decision about how we want to show constructors in the diff
|
||||||
- [x] When you delete a name with metadata, it also shows up in updates section
|
- [x] When you delete a name with metadata, it also shows up in updates section
|
||||||
with the deleted metadata.
|
with the deleted metadata.
|
||||||
|
Loading…
Reference in New Issue
Block a user