File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
share-api/src/Share/Web/Share/Branches Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -50,7 +50,6 @@ import Share.Web.Share.Projects.Types (projectToAPI)
5050import Share.Web.Share.Types
5151import U.Codebase.HashTags (CausalHash )
5252import Unison.Codebase.Path qualified as Path
53- import Unison.Debug qualified as Debug
5453import Unison.HashQualified qualified as HQ
5554import Unison.Name (Name )
5655import Unison.NameSegment.Internal (NameSegment (.. ))
@@ -508,13 +507,11 @@ branchHistoryEndpoint (AuthN.MaybeAuthedUserID callerUserId) userHandle projectS
508507 let codebaseLoc = Codebase. codebaseLocationForProjectBranchCodebase projectOwnerUserId contributorId
509508 let codebase = Codebase. codebaseEnv authZReceipt codebaseLoc
510509 causalId <- resolveRootHash codebase branchHead Nothing
511- Debug. debugM Debug. Temp " branchHistoryEndpoint Resolved causalId: " causalId
512510 PG. runTransaction do
513511 history <-
514512 CausalQ. pagedCausalAncestors causalId limit mayCursor
515513 <&> fmap \ (causalHash) ->
516514 BranchHistoryCausalEntry (BranchHistoryCausal {causalHash})
517- Debug. debugM Debug. Temp " branchHistoryEndpoint Retrieved history entries: " (history)
518515 pure $
519516 BranchHistoryResponse
520517 { projectRef,
Original file line number Diff line number Diff line change @@ -107,6 +107,13 @@ instance ToJSON BranchHistoryResponse where
107107 " history" .= history
108108 ]
109109
110+ instance FromJSON BranchHistoryResponse where
111+ parseJSON = withObject " BranchHistoryResponse" $ \ o ->
112+ BranchHistoryResponse
113+ <$> (o .: " projectRef" )
114+ <*> (o .: " branchRef" )
115+ <*> o .: " history"
116+
110117data BranchHistoryCausal = BranchHistoryCausal
111118 { causalHash :: CausalHash
112119 }
@@ -118,6 +125,11 @@ instance ToJSON BranchHistoryCausal where
118125 [ " causalHash" .= causalHash
119126 ]
120127
128+ instance FromJSON BranchHistoryCausal where
129+ parseJSON = withObject " BranchHistoryCausal" $ \ o ->
130+ BranchHistoryCausal
131+ <$> o .: " causalHash"
132+
121133data BranchHistoryEntry
122134 = BranchHistoryCausalEntry BranchHistoryCausal
123135 deriving stock (Eq , Show )
@@ -126,3 +138,8 @@ instance ToJSON BranchHistoryEntry where
126138 toJSON = \ case
127139 (BranchHistoryCausalEntry causal) ->
128140 toJSON (causal :++ (object [" tag" .= (" Changeset" :: Text )]))
141+
142+ instance FromJSON BranchHistoryEntry where
143+ parseJSON v = do
144+ causal <- parseJSON v
145+ return $ BranchHistoryCausalEntry causal
You can’t perform that action at this time.
0 commit comments