v8 repositories automatically upgrade to v9
(And v9 later on to v10.) When v9/v10 were added, making v8 automatically upgrade was deferred "for a few months" to prevent interoperability problems if users also have an old version of git-annex. Of course that could still be the case, but there has been a good amount of time and this can't be put off forever. Allow setting annex.autoupgraderepository to false to avoid this upgrade. Previously, that only prevented upgrades from no longer supported git-annex versions, but v8 is still supported, and users may want to keep on v8 to interoperate with an old git-annex version. Sponsored-by: Boyd Stephen Smith Jr. on Patreon
This commit is contained in:
parent
df3020fb7e
commit
63cef2ae0b
5 changed files with 38 additions and 13 deletions
18
Upgrade.hs
18
Upgrade.hs
|
@ -39,7 +39,12 @@ checkUpgrade = maybe noop giveup <=< needsUpgrade
|
|||
|
||||
needsUpgrade :: RepoVersion -> Annex (Maybe String)
|
||||
needsUpgrade v
|
||||
| v `elem` supportedVersions = ok
|
||||
| v `elem` supportedVersions = case M.lookup v autoUpgradeableVersions of
|
||||
Just newv | newv /= v -> ifM (annexAutoUpgradeRepository <$> Annex.getGitConfig)
|
||||
( runupgrade newv
|
||||
, ok
|
||||
)
|
||||
_ -> ok
|
||||
| otherwise = case M.lookup v autoUpgradeableVersions of
|
||||
Nothing
|
||||
| v `elem` upgradeableVersions ->
|
||||
|
@ -47,10 +52,7 @@ needsUpgrade v
|
|||
| otherwise ->
|
||||
err "Upgrade git-annex."
|
||||
Just newv -> ifM (annexAutoUpgradeRepository <$> Annex.getGitConfig)
|
||||
( tryNonAsync (upgrade True newv) >>= \case
|
||||
Right True -> ok
|
||||
Right False -> err "Automatic upgrade failed!"
|
||||
Left ex -> err $ "Automatic upgrade exception! " ++ show ex
|
||||
( runupgrade newv
|
||||
, err "Automatic upgrade is disabled by annex.autoupgraderepository configuration. To upgrade this repository: git-annex upgrade"
|
||||
)
|
||||
where
|
||||
|
@ -63,8 +65,14 @@ needsUpgrade v
|
|||
, show (fromRepoVersion v) ++ "."
|
||||
, msg
|
||||
]
|
||||
|
||||
ok = return Nothing
|
||||
|
||||
runupgrade newv = tryNonAsync (upgrade True newv) >>= \case
|
||||
Right True -> ok
|
||||
Right False -> err "Automatic upgrade failed!"
|
||||
Left ex -> err $ "Automatic upgrade exception! " ++ show ex
|
||||
|
||||
upgrade :: Bool -> RepoVersion -> Annex Bool
|
||||
upgrade automatic destversion = do
|
||||
startversion <- getVersion
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue