diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-14 15:31:44 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-14 15:31:44 -0400 |
commit | 859731ee5b09072d112296a073cb152007d7785a (patch) | |
tree | 9b996986b97be6723a08950a33e9ffc4e36e59be /Backend/File.hs | |
parent | 4b7e54eddb953ee3ec3ce1734e2748fc3e2f2f9f (diff) |
add hasKey
Diffstat (limited to 'Backend/File.hs')
-rw-r--r-- | Backend/File.hs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/Backend/File.hs b/Backend/File.hs index 311fe820b..893850a69 100644 --- a/Backend/File.hs +++ b/Backend/File.hs @@ -13,13 +13,16 @@ import LocationLog import Locations import qualified Remotes import qualified GitRepo as Git +import Utility +import Core backend = Backend { name = "file", getKey = keyValue, storeFileKey = dummyStore, retrieveKeyFile = copyKeyFile, - removeKey = dummyRemove + removeKey = dummyRemove, + hasKey = checkKeyFile } -- direct mapping from filename to key @@ -29,8 +32,7 @@ keyValue file = return $ Just $ Key file {- This backend does not really do any independant data storage, - it relies on the file contents in .git/annex/ in this repo, - and other accessible repos. So storing a key is - - a no-op. TODO until support is added for git annex --push otherrepo, - - then these could implement that.. -} + - a no-op. -} dummyStore :: FilePath -> Key -> Annex (Bool) dummyStore file key = return True @@ -38,6 +40,10 @@ dummyStore file key = return True dummyRemove :: Key -> Annex Bool dummyRemove url = return True +{- Just check if the .git/annex/ file for the key exists. -} +checkKeyFile :: Key -> Annex Bool +checkKeyFile k = inAnnex backend k + {- Try to find a copy of the file in one of the remotes, - and copy it over to this one. -} copyKeyFile :: Key -> FilePath -> Annex (Bool) |