summaryrefslogtreecommitdiff
path: root/Backend/File.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-10-14 13:11:42 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-10-14 13:11:42 -0400
commit8df3e2aa0227e426ade1d92f430e02e31bb97ad9 (patch)
treefee5e2bad45855397b26b982516155e062e02380 /Backend/File.hs
parent282d9853682f457cc6dc8b095b230bd892f0a5f3 (diff)
query remotes for uuids
(not cached yet)
Diffstat (limited to 'Backend/File.hs')
-rw-r--r--Backend/File.hs21
1 files changed, 13 insertions, 8 deletions
diff --git a/Backend/File.hs b/Backend/File.hs
index 107ef3851..78e1f5563 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -49,13 +49,16 @@ copyKeyFile key file = do
-- annexLocation needs the git config to have been
-- read for a remote, so do that now,
-- if it hasn't been already
- r' <- Remotes.ensureGitConfigRead r
- result <- liftIO $ (try (copyFromRemote r' key file)::IO (Either SomeException ()))
- case (result) of
- Left err -> do
- liftIO $ hPutStrLn stderr (show err)
- trycopy full rs
- Right succ -> return True
+ result <- Remotes.tryGitConfigRead r
+ case (result) of
+ Nothing -> trycopy full rs
+ Just r' -> do
+ result <- liftIO $ (try (copyFromRemote r' key file)::IO (Either SomeException ()))
+ case (result) of
+ Left err -> do
+ liftIO $ hPutStrLn stderr (show err)
+ trycopy full rs
+ Right succ -> return True
{- Tries to copy a file from a remote, exception on error. -}
copyFromRemote :: Git.Repo -> Key -> FilePath -> IO ()
@@ -67,6 +70,8 @@ copyFromRemote r key file = do
else getremote
return ()
where
- getlocal = rawSystem "cp" ["-a", location, file]
+ getlocal = do
+ rawSystem "cp" ["-a", location, file]
+ putStrLn "cp done"
getremote = error "get via network not yet implemented!"
location = annexLocation r backend key