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

2
debian/changelog vendored
View file

@ -5,6 +5,8 @@ git-annex (5.20150318) UNRELEASED; urgency=medium
to be present on a remote.
* Added a post-update-annex hook, which is run after the git-annex branch
is updated. Needed for git update-server-info.
* migrate: --force will force migration of keys already using the
destination backend. Useful in rare cases.
-- Joey Hess <id@joeyh.name> Thu, 19 Mar 2015 17:05:32 -0400

View file

@ -868,6 +868,7 @@ subdirectories).
Normally, nothing will be done to files already using the new backend.
However, if a backend changes the information it uses to construct a key,
this can also be used to migrate files to use the new key format.
(To force migration of keys already using the new backend, use --force.)
* `reinject src dest`