aboutsummaryrefslogtreecommitdiff
path: root/Command/Migrate.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2015-03-23 12:11:16 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2015-03-23 12:11:16 -0400
commitf622aa1dcb9f95274df584ab4c2f2199dbd94c54 (patch)
tree51d5d8d38df6366f64dce631de13b1e532f25b5d /Command/Migrate.hs
parentc4fbafa61b0dc1df1f2d00c2fb5352848ff36a5c (diff)
migrate: --force will force migration of keys already using the destination backend. Useful in rare cases.
Diffstat (limited to 'Command/Migrate.hs')
-rw-r--r--Command/Migrate.hs4
1 files changed, 3 insertions, 1 deletions
diff --git a/Command/Migrate.hs b/Command/Migrate.hs
index 46c0eb675..6ffe354d5 100644
--- a/Command/Migrate.hs
+++ b/Command/Migrate.hs
@@ -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