diff options
author | Joey Hess <joey@kitenet.net> | 2011-03-15 21:34:13 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-03-15 21:34:13 -0400 |
commit | 9d49fe2c172b135a1a3735827df014b5f45d99a2 (patch) | |
tree | 32caea71926c1b05d9b1921a16f364f57fc3e62f /Backend.hs | |
parent | 675ee89749ba2272d37b763078020b6e5f4cd380 (diff) |
first pass at using new keys
It compiles. It sorta works. Several subcommands are FIXME marked and
broken, because things that used to accept separate --backend and --key
params need to be changed to accept just a --key that encodes all the key
info, now that there is metadata in keys.
Diffstat (limited to 'Backend.hs')
-rw-r--r-- | Backend.hs | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/Backend.hs b/Backend.hs index df23e80a3..94755e8d6 100644 --- a/Backend.hs +++ b/Backend.hs @@ -39,6 +39,7 @@ import Locations import qualified GitRepo as Git import qualified Annex import Types +import Key import qualified BackendTypes as B import Messages @@ -135,18 +136,19 @@ lookupFile file = do getsymlink = do l <- readSymbolicLink file return $ takeFileName l - makekey bs l = do + makekey bs l = + case fileKey l of + Just k -> makeret k l bs + Nothing -> return Nothing + makeret k l bs = case maybeLookupBackendName bs bname of - Nothing -> do - unless (null kname || null bname || - not (isLinkToAnnex l)) $ - warning skip - return Nothing - Just backend -> return $ Just (k, backend) + Just backend -> return $ Just (k, backend) + Nothing -> do + when (isLinkToAnnex l) $ + warning skip + return Nothing where - k = fileKey l - bname = backendName k - kname = keyName k + bname = keyBackendName k skip = "skipping " ++ file ++ " (unknown backend " ++ bname ++ ")" @@ -164,4 +166,4 @@ chooseBackends fs = do keyBackend :: Key -> Annex (Backend Annex) keyBackend key = do bs <- Annex.getState Annex.supportedBackends - return $ lookupBackendName bs $ backendName key + return $ lookupBackendName bs $ keyBackendName key |