mirror of
https://github.com/unisonweb/unison.git
synced 2024-09-20 06:47:15 +03:00
delete unused TypedHash
This commit is contained in:
parent
2d0c8d55b1
commit
7735cdb6dd
@ -140,7 +140,6 @@ import qualified Unison.Sync.Types as Share
|
||||
RepoPath (..),
|
||||
hashJWTHash,
|
||||
)
|
||||
import qualified Unison.Sync.Types as Share.TypedHash (TypedHash (..))
|
||||
import Unison.Term (Term)
|
||||
import qualified Unison.Term as Term
|
||||
import Unison.Type (Type)
|
||||
|
@ -41,7 +41,6 @@ import qualified Data.Set.NonEmpty as NESet
|
||||
import Data.Vector (Vector)
|
||||
import qualified Data.Vector as Vector
|
||||
import Servant.Client (BaseUrl)
|
||||
import qualified Text.Regex.TDFA.CorePattern as List
|
||||
import U.Codebase.HashTags (CausalHash (..))
|
||||
import qualified U.Codebase.Sqlite.Branch.Format as NamespaceFormat
|
||||
import qualified U.Codebase.Sqlite.Causal as Causal
|
||||
@ -128,17 +127,8 @@ checkAndSetPush httpClient unisonShareUrl conn repoPath expectedHash causalHash
|
||||
unisonShareUrl
|
||||
Share.UpdatePathRequest
|
||||
{ path = repoPath,
|
||||
expectedHash =
|
||||
expectedHash <&> \hash ->
|
||||
Share.TypedHash
|
||||
{ hash,
|
||||
entityType = Share.CausalType
|
||||
},
|
||||
newHash =
|
||||
Share.TypedHash
|
||||
{ hash = causalHashToHash causalHash,
|
||||
entityType = Share.CausalType
|
||||
}
|
||||
expectedHash,
|
||||
newHash = causalHashToHash causalHash
|
||||
}
|
||||
|
||||
-- | An error occurred while fast-forward pushing code to Unison Share.
|
||||
|
@ -8,7 +8,6 @@ module Unison.Sync.Types
|
||||
|
||||
-- ** Hash types
|
||||
Hash (..),
|
||||
TypedHash (..),
|
||||
HashJWT (..),
|
||||
hashJWTHash,
|
||||
HashJWTClaims (..),
|
||||
@ -51,9 +50,9 @@ module Unison.Sync.Types
|
||||
-- ** Update path
|
||||
UpdatePathRequest (..),
|
||||
UpdatePathResponse (..),
|
||||
|
||||
-- * Error types
|
||||
HashMismatch (..),
|
||||
|
||||
-- * Common/shared error types
|
||||
NeedDependencies (..),
|
||||
)
|
||||
where
|
||||
@ -117,25 +116,6 @@ instance FromJSON RepoPath where
|
||||
newtype Hash = Hash {toBase32Hex :: Base32Hex}
|
||||
deriving (Show, Eq, Ord, ToJSON, FromJSON, ToJSONKey, FromJSONKey) via (Text)
|
||||
|
||||
data TypedHash = TypedHash
|
||||
{ hash :: Hash,
|
||||
entityType :: EntityType
|
||||
}
|
||||
deriving stock (Show, Eq, Ord)
|
||||
|
||||
instance ToJSON TypedHash where
|
||||
toJSON (TypedHash hash entityType) =
|
||||
object
|
||||
[ "hash" .= hash,
|
||||
"type" .= entityType
|
||||
]
|
||||
|
||||
instance FromJSON TypedHash where
|
||||
parseJSON = Aeson.withObject "TypedHash" \obj -> do
|
||||
hash <- obj .: "hash"
|
||||
entityType <- obj .: "type"
|
||||
pure TypedHash {..}
|
||||
|
||||
newtype HashJWT = HashJWT {unHashJWT :: Text}
|
||||
deriving newtype (Show, Eq, Ord, ToJSON, FromJSON)
|
||||
|
||||
@ -748,8 +728,8 @@ instance FromJSON FastForwardPathResponse where
|
||||
|
||||
data UpdatePathRequest = UpdatePathRequest
|
||||
{ path :: RepoPath,
|
||||
expectedHash :: Maybe TypedHash, -- Nothing requires empty history at destination
|
||||
newHash :: TypedHash
|
||||
expectedHash :: Maybe Hash, -- Nothing requires empty history at destination
|
||||
newHash :: Hash
|
||||
}
|
||||
deriving stock (Show, Eq, Ord)
|
||||
|
||||
@ -792,13 +772,10 @@ instance FromJSON UpdatePathResponse where
|
||||
"no_write_permission" -> UpdatePathNoWritePermission <$> obj .: "payload"
|
||||
t -> failText $ "Unexpected UpdatePathResponse type: " <> t
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
-- Error types
|
||||
|
||||
data HashMismatch = HashMismatch
|
||||
{ repoPath :: RepoPath,
|
||||
expectedHash :: Maybe TypedHash,
|
||||
actualHash :: Maybe TypedHash
|
||||
expectedHash :: Maybe Hash,
|
||||
actualHash :: Maybe Hash
|
||||
}
|
||||
deriving stock (Show, Eq, Ord)
|
||||
|
||||
@ -817,6 +794,9 @@ instance FromJSON HashMismatch where
|
||||
actualHash <- obj .: "actual_hash"
|
||||
pure HashMismatch {..}
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
-- Common/shared error types
|
||||
|
||||
data NeedDependencies hash = NeedDependencies
|
||||
{ missingDependencies :: NESet hash
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user