separate source of content from the filename associated with the key when generating a key

This already made migrate's code a lot simpler.
This commit is contained in:
Joey Hess 2012-06-05 19:51:03 -04:00
parent 77188ff04d
commit d3cee987ca
9 changed files with 59 additions and 57 deletions

View file

@ -11,7 +11,7 @@ import Network.URI
import Common.Annex
import Command
import qualified Backend
import Backend
import qualified Command.Add
import qualified Annex
import qualified Backend.URL
@ -72,8 +72,9 @@ download url file = do
tmp <- fromRepo $ gitAnnexTmpLocation dummykey
liftIO $ createDirectoryIfMissing True (parentDir tmp)
stopUnless (downloadUrl [url] tmp) $ do
backend <- Backend.chooseBackend file
k <- Backend.genKey tmp backend
backend <- chooseBackend file
let source = KeySource { keyFilename = file, contentLocation = file}
k <- genKey source backend
case k of
Nothing -> stop
Just (key, _) -> do