summaryrefslogtreecommitdiff
path: root/Backend
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-14 17:37:20 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-14 17:38:13 -0400
commit508a3b65ed675c9322940578614f088ea2c74e7f (patch)
treec3564f59aee2351d8bd7e8ce42ade05f8207e6b8 /Backend
parentaa2f4bd81049e3bcaad6f5f1334864ce14887527 (diff)
annex.numcopies works
Diffstat (limited to 'Backend')
-rw-r--r--Backend/File.hs13
1 files changed, 13 insertions, 0 deletions
diff --git a/Backend/File.hs b/Backend/File.hs
index 893850a69..def2f3091 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -15,6 +15,8 @@ import qualified Remotes
import qualified GitRepo as Git
import Utility
import Core
+import qualified Annex
+import UUID
backend = Backend {
name = "file",
@@ -49,6 +51,9 @@ checkKeyFile k = inAnnex backend k
copyKeyFile :: Key -> FilePath -> Annex (Bool)
copyKeyFile key file = do
remotes <- Remotes.withKey key
+ if (0 == length remotes)
+ then cantfind
+ else return ()
trycopy remotes remotes
where
trycopy full [] = error $ "unable to get: " ++ (keyFile key) ++ "\n" ++
@@ -68,6 +73,14 @@ copyKeyFile key file = do
liftIO $ hPutStrLn stderr (show err)
trycopy full rs
Right succ -> return True
+ cantfind = do
+ g <- Annex.gitRepo
+ uuids <- liftIO $ keyLocations g key
+ error $ "no available git remotes have: " ++
+ (keyFile key) ++ (uuidlist uuids)
+ uuidlist [] = ""
+ uuidlist uuids = "\nIt has been seen before in these repositories:\n" ++
+ prettyPrintUUIDs uuids
{- Tries to copy a file from a remote, exception on error. -}
copyFromRemote :: Git.Repo -> Key -> FilePath -> IO ()