diff options
Diffstat (limited to 'Command/Migrate.hs')
-rw-r--r-- | Command/Migrate.hs | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/Command/Migrate.hs b/Command/Migrate.hs index c14c07bdd..18e6e0748 100644 --- a/Command/Migrate.hs +++ b/Command/Migrate.hs @@ -25,15 +25,19 @@ def = [notDirect $ seek :: CommandSeek seek = withFilesInGit $ whenAnnexed start -start :: FilePath -> (Key, Backend) -> CommandStart -start file (key, oldbackend) = do - exists <- inAnnex key - newbackend <- choosebackend =<< chooseBackend file - if (newbackend /= oldbackend || upgradableKey oldbackend key) && exists - then do - showStart "migrate" file - next $ perform file key oldbackend newbackend - else stop +start :: FilePath -> Key -> CommandStart +start file key = do + v <- Backend.getBackend file key + case v of + Nothing -> stop + Just oldbackend -> do + exists <- inAnnex key + newbackend <- choosebackend =<< chooseBackend file + if (newbackend /= oldbackend || upgradableKey oldbackend key) && exists + then do + showStart "migrate" file + next $ perform file key oldbackend newbackend + else stop where choosebackend Nothing = Prelude.head <$> orderedList choosebackend (Just backend) = return backend |