summaryrefslogtreecommitdiff
path: root/Command/Migrate.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-01-11 21:32:38 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-01-11 21:32:38 -0400
commite18a4d566b4f205c8a60ddf79ce02ba023d34984 (patch)
tree0619f017f42d5b6941051da42024431e38e39feb /Command/Migrate.hs
parentb557a2ccf4cd634a2c276b9ae03b881814de58be (diff)
migrate: Fix support for --backend option.
Diffstat (limited to 'Command/Migrate.hs')
-rw-r--r--Command/Migrate.hs9
1 files changed, 7 insertions, 2 deletions
diff --git a/Command/Migrate.hs b/Command/Migrate.hs
index 3d6121437..59ad36a2b 100644
--- a/Command/Migrate.hs
+++ b/Command/Migrate.hs
@@ -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