diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-22 15:06:14 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-22 15:06:57 -0400 |
commit | aafb63edb13ac87eb5d741c75b90de6115f06452 (patch) | |
tree | 215b3db561ef0548f73971688f1bf0dfafbb5dea /Backend/File.hs | |
parent | 91e6625eb56671472abd9532a5635f541d025a60 (diff) |
support checking network remotes when dropping
Diffstat (limited to 'Backend/File.hs')
-rw-r--r-- | Backend/File.hs | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/Backend/File.hs b/Backend/File.hs index b99a064ae..15d8f4a26 100644 --- a/Backend/File.hs +++ b/Backend/File.hs @@ -44,9 +44,18 @@ mustProvide = error "must provide this field" dummyStore :: FilePath -> Key -> Annex (Bool) dummyStore file key = return True -{- Just check if the .git/annex/ file for the key exists. -} +{- Just check if the .git/annex/ file for the key exists. + - + - But, if running against a remote annex, need to use ssh to do it. -} checkKeyFile :: Key -> Annex Bool -checkKeyFile k = inAnnex k +checkKeyFile k = do + g <- Annex.gitRepo + if (not $ Git.repoIsUrl g) + then inAnnex k + else do + showNote ("checking " ++ Git.repoDescribe g ++ "...") + liftIO $ boolSystem "ssh" [Git.urlHost g, + "test -e " ++ (shellEscape $ annexLocation g k)] {- Try to find a copy of the file in one of the remotes, - and copy it over to this one. -} @@ -85,11 +94,13 @@ copyFromRemote r key file = do then getssh else error "copying from non-ssh repo not supported" where - location = annexLocation r key getlocal = boolSystem "cp" ["-a", location, file] getssh = do liftIO $ putStrLn "" -- make way for scp progress bar - boolSystem "scp" [location, file] + -- TODO double-shell-quote path for scp + boolSystem "scp" [sshlocation, file] + location = annexLocation r key + sshlocation = (Git.urlHost r) ++ ":" ++ location showLocations :: Key -> Annex () showLocations key = do |