summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-15 19:32:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-15 19:32:56 -0400
commite67887d98b61aeabffc9d1a231421bb00848dd13 (patch)
treed7a46b9463ecab37e0ba1fec2979f5e86305133e
parent946a7f3f2128704c7b4eeea265a1375c1b60c622 (diff)
lift to IO
-rw-r--r--Backend/File.hs13
-rw-r--r--UUID.hs4
2 files changed, 11 insertions, 6 deletions
diff --git a/Backend/File.hs b/Backend/File.hs
index eba4b88f8..b2c5c90eb 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -26,12 +26,16 @@ import qualified Annex
import UUID
backend = Backend {
+ name = mustProvide,
+ getKey = mustProvide,
storeFileKey = dummyStore,
retrieveKeyFile = copyKeyFile,
removeKey = dummyRemove,
hasKey = checkKeyFile
}
+mustProvide = error "must provide this field"
+
{- Storing a key is a no-op. -}
dummyStore :: FilePath -> Key -> Annex (Bool)
dummyStore file key = return True
@@ -74,11 +78,12 @@ copyKeyFile key file = do
cantfind = do
g <- Annex.gitRepo
uuids <- liftIO $ keyLocations g key
+ ppuuids <- prettyPrintUUIDs uuids
error $ "no available git remotes have: " ++
- (keyFile key) ++ (uuidlist uuids)
- uuidlist [] = ""
- uuidlist uuids = "\nIt has been seen before in these repositories:\n" ++
- prettyPrintUUIDs uuids
+ (keyFile key) ++
+ if (0 < length uuids)
+ then "\nIt has been seen before in these repositories:\n" ++ ppuuids
+ else ""
{- Tries to copy a file from a remote, exception on error. -}
copyFromRemote :: Git.Repo -> Key -> FilePath -> IO ()
diff --git a/UUID.hs b/UUID.hs
index 9348c7b43..3653eeec4 100644
--- a/UUID.hs
+++ b/UUID.hs
@@ -91,7 +91,7 @@ reposByUUID repos uuids = do
{- Pretty-prints a list of UUIDs
- TODO: use lookup file to really show pretty names. -}
-prettyPrintUUIDs :: [UUID] -> String
+prettyPrintUUIDs :: [UUID] -> Annex String
prettyPrintUUIDs uuids =
- unwords $ map (\u -> "\tUUID "++u++"\n") uuids
+ return $ unwords $ map (\u -> "\tUUID "++u++"\n") uuids