display filenames in migrate --update
Have to go to a lot of bother to find them, but I think it's worth it for usability. Sponsored-by: Luke T. Shumaker on Patreon
This commit is contained in:
parent
abea01d9e0
commit
62ce56c4ea
2 changed files with 28 additions and 11 deletions
|
@ -20,6 +20,9 @@ import Logs.MetaData
|
||||||
import Logs.Web
|
import Logs.Web
|
||||||
import Logs.Location
|
import Logs.Location
|
||||||
import Utility.Metered
|
import Utility.Metered
|
||||||
|
import qualified Database.Keys
|
||||||
|
import Git.FilePath
|
||||||
|
import Annex.Link
|
||||||
|
|
||||||
cmd :: Command
|
cmd :: Command
|
||||||
cmd = withAnnexOptions [backendOption, annexedMatchingOptions, jsonOptions] $
|
cmd = withAnnexOptions [backendOption, annexedMatchingOptions, jsonOptions] $
|
||||||
|
@ -50,7 +53,8 @@ seek o
|
||||||
| updateOption o = do
|
| updateOption o = do
|
||||||
unless (null (migrateThese o)) $
|
unless (null (migrateThese o)) $
|
||||||
error "Cannot combine --update with files to migrate."
|
error "Cannot combine --update with files to migrate."
|
||||||
commandAction update
|
streamNewDistributedMigrations $ \oldkey newkey ->
|
||||||
|
commandAction $ update oldkey newkey
|
||||||
| otherwise = do
|
| otherwise = do
|
||||||
withFilesInGitAnnex ww seeker =<< workTreeItems ww (migrateThese o)
|
withFilesInGitAnnex ww seeker =<< workTreeItems ww (migrateThese o)
|
||||||
commitMigration
|
commitMigration
|
||||||
|
@ -143,10 +147,22 @@ perform onlyremovesize o file oldkey oldkeyrec oldbackend newbackend = go =<< ge
|
||||||
| otherwise = k
|
| otherwise = k
|
||||||
afile = AssociatedFile (Just file)
|
afile = AssociatedFile (Just file)
|
||||||
|
|
||||||
update :: CommandStart
|
update :: Key -> Key -> CommandStart
|
||||||
update = starting "migrate" (ActionItemOther Nothing) (SeekInput []) $ do
|
update oldkey newkey =
|
||||||
streamNewDistributedMigrations $ \oldkey newkey ->
|
stopUnless ((not <$> inAnnex newkey) <&&> inAnnex oldkey) $ do
|
||||||
unlessM (inAnnex newkey) $
|
ai <- findworktreefile >>= return . \case
|
||||||
whenM (Command.ReKey.linkKey' oldkey newkey) $
|
Just f -> ActionItemAssociatedFile (AssociatedFile (Just f)) newkey
|
||||||
logStatus newkey InfoPresent
|
Nothing -> ActionItemKey newkey
|
||||||
next $ return True
|
starting "migrate" ai (SeekInput []) $
|
||||||
|
ifM (Command.ReKey.linkKey' oldkey newkey)
|
||||||
|
( do
|
||||||
|
logStatus newkey InfoPresent
|
||||||
|
next $ return True
|
||||||
|
, next $ return False
|
||||||
|
)
|
||||||
|
where
|
||||||
|
findworktreefile = do
|
||||||
|
fs <- Database.Keys.getAssociatedFiles newkey
|
||||||
|
g <- Annex.gitRepo
|
||||||
|
firstM (\f -> (== Just newkey) <$> isAnnexLink f) $
|
||||||
|
map (\f -> simplifyPath (fromTopFilePath f g)) fs
|
||||||
|
|
|
@ -12,10 +12,11 @@ git annex migrate --update
|
||||||
|
|
||||||
Changes the specified annexed files to use the default key-value backend
|
Changes the specified annexed files to use the default key-value backend
|
||||||
(or the one specified with `--backend`). Only files whose content
|
(or the one specified with `--backend`). Only files whose content
|
||||||
is currently available are migrated.
|
is currently present are migrated.
|
||||||
|
|
||||||
Note that the content is also still available using the old key after
|
Note that the content is also still stored using the old keys after
|
||||||
migration. Use `git annex unused` to find and remove the old key.
|
migration. When possible, hard links are used to avoid that taking up
|
||||||
|
extra disk space. Use `git annex unused` to find and remove the old keys.
|
||||||
|
|
||||||
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,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue