diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-22 13:21:43 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-22 13:25:19 -0400 |
commit | 9f13f3ac5e7d20df91cb57af5e630fd48776d775 (patch) | |
tree | 77bb78613af2713718c753285b1abb8d4b004eff /Backend | |
parent | 8da596feff4f402fec08b6fd3815fd32e9770af6 (diff) |
support using scp for ssh remotes
Diffstat (limited to 'Backend')
-rw-r--r-- | Backend/File.hs | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/Backend/File.hs b/Backend/File.hs index d1ed1ec64..d28b92728 100644 --- a/Backend/File.hs +++ b/Backend/File.hs @@ -73,7 +73,7 @@ copyKeyFile key file = do case (result) of Left err -> trycopy full rs Right r' -> do - showNote $ "copying from " ++ (Git.repoDescribe r ) ++ "..." + showNote $ "copying from " ++ (Git.repoDescribe r) ++ "..." liftIO $ copyFromRemote r' key file {- Tries to copy a file from a remote. -} @@ -81,11 +81,15 @@ copyFromRemote :: Git.Repo -> Key -> FilePath -> IO Bool copyFromRemote r key file = do if (Git.repoIsLocal r) then getlocal - else getremote + else if (Git.repoIsSsh r) + then getssh + else error "copying from non-ssh repo not supported" where - getlocal = boolSystem "cp" ["-a", location, file] - getremote = return False -- TODO implement get from remote location = annexLocation r key + getlocal = boolSystem "cp" ["-a", location, file] + getssh = do + liftIO $ putStrLn "" -- make way for scp progress bar + boolSystem "scp" [location, file] showLocations :: Key -> Annex () showLocations key = do @@ -130,10 +134,10 @@ checkRemoveKey key = do Right True -> findcopies need (have+1) rs bad Right False -> findcopies need have rs bad Left _ -> findcopies need have rs (r:bad) - remoteHasKey r all = do + remoteHasKey remote all = do -- To check if a remote has a key, construct a new -- Annex monad and query its backend. - a <- Annex.new r all + a <- Annex.new remote all (result, _) <- Annex.run a (Backend.hasKey key) return result notEnoughCopies need have bad = do |