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 Annex.Content
import qualified Command.ReKey import qualified Command.ReKey
import qualified Command.Fsck import qualified Command.Fsck
import qualified Annex
cmd :: [Command] cmd :: [Command]
cmd = [notDirect $ withOptions annexedMatchingOptions $ cmd = [notDirect $ withOptions annexedMatchingOptions $
@ -27,13 +28,14 @@ seek = withFilesInGit $ whenAnnexed start
start :: FilePath -> Key -> CommandStart start :: FilePath -> Key -> CommandStart
start file key = do start file key = do
forced <- Annex.getState Annex.force
v <- Backend.getBackend file key v <- Backend.getBackend file key
case v of case v of
Nothing -> stop Nothing -> stop
Just oldbackend -> do Just oldbackend -> do
exists <- inAnnex key exists <- inAnnex key
newbackend <- choosebackend =<< chooseBackend file newbackend <- choosebackend =<< chooseBackend file
if (newbackend /= oldbackend || upgradableKey oldbackend key) && exists if (newbackend /= oldbackend || upgradableKey oldbackend key || forced) && exists
then do then do
showStart "migrate" file showStart "migrate" file
next $ perform file key oldbackend newbackend 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. to be present on a remote.
* Added a post-update-annex hook, which is run after the git-annex branch * Added a post-update-annex hook, which is run after the git-annex branch
is updated. Needed for git update-server-info. 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 -- 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. 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, 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. 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` * `reinject src dest`