summaryrefslogtreecommitdiff
path: root/Backend.hs
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.hs
parentaa2f4bd81049e3bcaad6f5f1334864ce14887527 (diff)
annex.numcopies works
Diffstat (limited to 'Backend.hs')
-rw-r--r--Backend.hs15
1 files changed, 14 insertions, 1 deletions
diff --git a/Backend.hs b/Backend.hs
index 7a8178a8e..47e42b822 100644
--- a/Backend.hs
+++ b/Backend.hs
@@ -15,8 +15,9 @@
module Backend (
storeFileKey,
- removeKey,
retrieveKeyFile,
+ removeKey,
+ hasKey,
lookupFile
) where
@@ -77,6 +78,18 @@ retrieveKeyFile backend key dest = (B.retrieveKeyFile backend) key dest
removeKey :: Backend -> Key -> Annex Bool
removeKey backend key = (B.removeKey backend) key
+{- Checks if any backend has a key. -}
+hasKey :: Key -> Annex Bool
+hasKey key = do
+ b <- backendList
+ hasKey' b key
+hasKey' [] key = return False
+hasKey' (b:bs) key = do
+ has <- (B.hasKey b) key
+ if (has)
+ then return True
+ else hasKey' bs key
+
{- Looks up the key and backend corresponding to an annexed file,
- by examining what the file symlinks to. -}
lookupFile :: FilePath -> IO (Maybe (Key, Backend))