diff options
author | 2011-11-10 23:35:08 -0400 | |
---|---|---|
committer | 2011-11-10 23:45:14 -0400 | |
commit | b327227ba596d4fc5012138d03390c3eb861b808 (patch) | |
tree | 921c3ca6851d1ede45c387d9fd54997dcbf44906 /Command/Migrate.hs | |
parent | 4389782628a1cc683ef238e848b6311fc4bd82c3 (diff) |
better limiting of start actions to only run whenAnnexed
Mostly only refactoring, but this does remove one redundant stat of the
symlink by copy.
Diffstat (limited to 'Command/Migrate.hs')
-rw-r--r-- | Command/Migrate.hs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Command/Migrate.hs b/Command/Migrate.hs index a823466dc..3c87f4136 100644 --- a/Command/Migrate.hs +++ b/Command/Migrate.hs @@ -13,17 +13,16 @@ import qualified Backend import qualified Types.Key import Annex.Content import qualified Command.Add -import Backend import Logs.Web def :: [Command] def = [command "migrate" paramPaths seek "switch data to different backend"] seek :: [CommandSeek] -seek = [withBackendFilesInGit start] +seek = [withBackendFilesInGit $ \(b, f) -> whenAnnexed (start b) f] -start :: BackendFile -> CommandStart -start (b, file) = isAnnexed file $ \(key, oldbackend) -> do +start :: Maybe (Backend Annex) -> FilePath -> (Key, Backend Annex) -> CommandStart +start b file (key, oldbackend) = do exists <- inAnnex key newbackend <- choosebackend b if (newbackend /= oldbackend || upgradableKey key) && exists |