migrate: --force will force migration of keys already using the destination backend. Useful in rare cases.

This commit is contained in:
Joey Hess 2015-03-23 12:11:16 -04:00
parent 42f98460b9
commit c233f98564
3 changed files with 6 additions and 1 deletions

View file

@ -16,6 +16,7 @@ import Types.KeySource
import Annex.Content
import qualified Command.ReKey
import qualified Command.Fsck
import qualified Annex
cmd :: [Command]
cmd = [notDirect $ withOptions annexedMatchingOptions $
@ -27,13 +28,14 @@ seek = withFilesInGit $ whenAnnexed start
start :: FilePath -> Key -> CommandStart
start file key = do
forced <- Annex.getState Annex.force
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
if (newbackend /= oldbackend || upgradableKey oldbackend key || forced) && exists
then do
showStart "migrate" file
next $ perform file key oldbackend newbackend