cost bugfixes

This commit is contained in:
Joey Hess 2011-03-30 15:15:46 -04:00
parent fdd455e913
commit 0c73c08c1c
6 changed files with 37 additions and 27 deletions

View file

@ -15,8 +15,6 @@ import Data.Map as M
import qualified GitRepo as Git
import Key
type Cost = Int
{- There are different types of remotes. -}
data RemoteType a = RemoteType {
-- human visible type name
@ -24,7 +22,7 @@ data RemoteType a = RemoteType {
-- enumerates remotes of this type
enumerate :: a [Git.Repo],
-- generates a remote of this type
generate :: Git.Repo -> String -> Cost -> Maybe (M.Map String String) -> a (Remote a),
generate :: Git.Repo -> String -> Maybe (M.Map String String) -> a (Remote a),
-- initializes or changes a remote
setup :: String -> M.Map String String -> a (M.Map String String)
}
@ -36,7 +34,7 @@ data Remote a = Remote {
-- each Remote has a human visible name
name :: String,
-- Remotes have a use cost; higher is more expensive
cost :: Cost,
cost :: Int,
-- Transfers a key to the remote.
storeKey :: Key -> a Bool,
-- retrieves a key's contents to a file
@ -54,7 +52,7 @@ data Remote a = Remote {
}
instance Show (Remote a) where
show remote = "Remote { uuid =\"" ++ uuid remote ++ "\" }"
show remote = "Remote { name =\"" ++ name remote ++ "\" }"
-- two remotes are the same if they have the same uuid
instance Eq (Remote a) where