migrate: Fix support for --backend option.

This commit is contained in:
Joey Hess 2011-01-11 21:32:38 -04:00
parent b557a2ccf4
commit e18a4d566b
3 changed files with 10 additions and 4 deletions

View file

@ -27,15 +27,20 @@ seek :: [CommandSeek]
seek = [withBackendFilesInGit start]
start :: CommandStartBackendFile
start (_, Nothing) = return Nothing
start (file, Just newbackend) = isAnnexed file $ \(key, oldbackend) -> do
start (file, b) = isAnnexed file $ \(key, oldbackend) -> do
exists <- inAnnex key
newbackend <- choosebackend b
if (newbackend /= oldbackend) && exists
then do
showStart "migrate" file
return $ Just $ perform file key newbackend
else
return Nothing
where
choosebackend Nothing = do
backends <- Backend.list
return $ head backends
choosebackend (Just backend) = return backend
perform :: FilePath -> Key -> Backend -> CommandPerform
perform file oldkey newbackend = do