diff options
author | Joey Hess <joey@kitenet.net> | 2012-06-05 19:51:03 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-06-05 19:51:03 -0400 |
commit | d3cee987caf20b309334b37bd1b89e8b9115cf0a (patch) | |
tree | 8c1a244545efed3b2fd9e48ea28faac12aa326fe /Backend.hs | |
parent | 77188ff04d8d4d42b25daac9eeffbf10d8b663ac (diff) |
separate source of content from the filename associated with the key when generating a key
This already made migrate's code a lot simpler.
Diffstat (limited to 'Backend.hs')
-rw-r--r-- | Backend.hs | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Backend.hs b/Backend.hs index fa3266944..bde1aad78 100644 --- a/Backend.hs +++ b/Backend.hs @@ -6,6 +6,7 @@ -} module Backend ( + B.KeySource(..), list, orderedList, genKey, @@ -51,18 +52,19 @@ orderedList = do parseBackendList s = map lookupBackendName $ words s {- Generates a key for a file, trying each backend in turn until one - - accepts it. -} -genKey :: FilePath -> Maybe Backend -> Annex (Maybe (Key, Backend)) -genKey file trybackend = do + - accepts it. + -} +genKey :: B.KeySource -> Maybe Backend -> Annex (Maybe (Key, Backend)) +genKey source trybackend = do bs <- orderedList let bs' = maybe bs (: bs) trybackend - genKey' bs' file -genKey' :: [Backend] -> FilePath -> Annex (Maybe (Key, Backend)) + genKey' bs' source +genKey' :: [Backend] -> B.KeySource -> Annex (Maybe (Key, Backend)) genKey' [] _ = return Nothing -genKey' (b:bs) file = do - r <- B.getKey b file +genKey' (b:bs) source = do + r <- B.getKey b source case r of - Nothing -> genKey' bs file + Nothing -> genKey' bs source Just k -> return $ Just (makesane k, b) where -- keyNames should not contain newline characters. |