Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions unison-cli/src/Unison/CommandLine/InputPatterns.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2488,10 +2488,18 @@ diffBranch =
args -> wrongArgsLength "two arguments" args
}
where
-- TODO handle causal hash
handleDiffBranchTargetArg :: I.Argument -> Either (P.Pretty P.ColorText) Input.DiffBranchArg
handleDiffBranchTargetArg arg =
Input.DiffBranchArg'Branch <$> handleMaybeProjectBranchArg arg
handleDiffBranchTargetArg = \case
I.RawArg raw ->
if take 1 raw == "#"
then case Input.parseShortCausalHash raw of
Right sch -> Right (Input.DiffBranchArg'Hash sch)
Left err -> Left (P.string err)
else megaparse (Input.DiffBranchArg'Branch <$> branchWithOptionalProjectParser) (Text.pack raw)
I.StructuredArg sa -> case sa of
SA.ProjectBranch pb -> Right (Input.DiffBranchArg'Branch pb)
SA.Namespace hash -> Right (Input.DiffBranchArg'Hash (SCH.fromFullHash hash))
otherArgType -> Left (wrongStructuredArgument "a branch or hash" otherArgType)

diffNamespace :: InputPattern
diffNamespace =
Expand Down
Loading