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:
Joey Hess 2022-07-25 16:09:11 -04:00
parent df3020fb7e
commit 63cef2ae0b
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
5 changed files with 38 additions and 13 deletions

View file

@ -19,7 +19,7 @@ import qualified Annex
import qualified Data.Map as M import qualified Data.Map as M
defaultVersion :: RepoVersion defaultVersion :: RepoVersion
defaultVersion = RepoVersion 8 defaultVersion = RepoVersion 10
latestVersion :: RepoVersion latestVersion :: RepoVersion
latestVersion = RepoVersion 10 latestVersion = RepoVersion 10
@ -42,7 +42,7 @@ autoUpgradeableVersions = M.fromList
, (RepoVersion 6, defaultVersion) , (RepoVersion 6, defaultVersion)
, (RepoVersion 7, defaultVersion) , (RepoVersion 7, defaultVersion)
, (RepoVersion 8, defaultVersion) , (RepoVersion 8, defaultVersion)
, (RepoVersion 9, latestVersion) , (RepoVersion 9, defaultVersion)
] ]
versionField :: ConfigKey versionField :: ConfigKey

View file

@ -1,3 +1,12 @@
git-annex (10.20220725) UNRELEASED; urgency=medium
* v8 repositories automatically upgrade to v9, which will in turn
automatically upgrade to v10 in a year's time.
To avoid this upgrade, you can set annex.autoupgraderepository to false.
* Use v10 by default for new repositories.
-- Joey Hess <id@joeyh.name> Mon, 25 Jul 2022 15:35:45 -0400
git-annex (10.20220724) upstream; urgency=medium git-annex (10.20220724) upstream; urgency=medium
* filter-process: Fix a bug involving handling of empty files, * filter-process: Fix a bug involving handling of empty files,

View file

@ -39,7 +39,12 @@ checkUpgrade = maybe noop giveup <=< needsUpgrade
needsUpgrade :: RepoVersion -> Annex (Maybe String) needsUpgrade :: RepoVersion -> Annex (Maybe String)
needsUpgrade v 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 | otherwise = case M.lookup v autoUpgradeableVersions of
Nothing Nothing
| v `elem` upgradeableVersions -> | v `elem` upgradeableVersions ->
@ -47,10 +52,7 @@ needsUpgrade v
| otherwise -> | otherwise ->
err "Upgrade git-annex." err "Upgrade git-annex."
Just newv -> ifM (annexAutoUpgradeRepository <$> Annex.getGitConfig) Just newv -> ifM (annexAutoUpgradeRepository <$> Annex.getGitConfig)
( tryNonAsync (upgrade True newv) >>= \case ( runupgrade newv
Right True -> ok
Right False -> err "Automatic upgrade failed!"
Left ex -> err $ "Automatic upgrade exception! " ++ show ex
, err "Automatic upgrade is disabled by annex.autoupgraderepository configuration. To upgrade this repository: git-annex upgrade" , err "Automatic upgrade is disabled by annex.autoupgraderepository configuration. To upgrade this repository: git-annex upgrade"
) )
where where
@ -63,8 +65,14 @@ needsUpgrade v
, show (fromRepoVersion v) ++ "." , show (fromRepoVersion v) ++ "."
, msg , msg
] ]
ok = return Nothing 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 :: Bool -> RepoVersion -> Annex Bool
upgrade automatic destversion = do upgrade automatic destversion = do
startversion <- getVersion startversion <- getVersion

View file

@ -1181,13 +1181,18 @@ repository, using [[git-annex-config]]. See its man page for a list.)
* `annex.autoupgraderepository` * `annex.autoupgraderepository`
When an old git-annex repository version has become deprecated, When an old git-annex repository version is no longer supported,
git-annex will normally automatically upgrade the repository to git-annex will normally automatically upgrade the repository to
the new version. the new version. It may also sometimes upgrade from an old repository
version that is still supported but that is not as good as a later
version.
If this is set to false, git-annex won't automatically upgrade the If this is set to false, git-annex won't automatically upgrade the
repository. Instead it will exit with an error message. You can run repository. If the repository version is not supported, git-annex
`git annex upgrade` yourself when you are ready to upgrade the will instead exit with an error message. If it is still supported,
git-annex will continue to work.
You can run `git annex upgrade` yourself when you are ready to upgrade the
repository. repository.
* `annex.crippledfilesystem` * `annex.crippledfilesystem`

View file

@ -61,12 +61,15 @@ it very unlikely that such a process is still running.
## v8 -> v9 (git-annex version 10.x) ## v8 -> v9 (git-annex version 10.x)
v8 repositories are not yet automatically upgraded to v9. v8 repositories are automatically upgraded to v9.
v9 is a stepping stone to the v10 upgrade. By adding this intermediate v9 is a stepping stone to the v10 upgrade. By adding this intermediate
version, old versions of git-annex that only support v8 will not be able to version, old versions of git-annex that only support v8 will not be able to
start new processes in the repository after the v9 upgrade. start new processes in the repository after the v9 upgrade.
v9 also enables using `git-annex filter-process`. This can significantly
speed up git operations involving unlocked files.
## v7 -> v8 (git-annex version 8.x) ## v7 -> v8 (git-annex version 8.x)
v7 repositories are automatically upgraded to v8. v7 repositories are automatically upgraded to v8.
@ -95,7 +98,7 @@ dotfiles to git by default, unless annex.dotfiles is set to true.
v6 repositories are automatically upgraded to v7. v6 repositories are automatically upgraded to v7.
The only difference between v6 and v7 is that some additional git hooks The only difference between v6 and v7 is that some additional git hooks
were added in v7. See below for details about what's new in v6/v7. were added in v7.
## v5 -> v6 (git-annex version 6.x) ## v5 -> v6 (git-annex version 6.x)