From 63cef2ae0b4069050fe43b14cd1656fbc843b9a4 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Mon, 25 Jul 2022 16:09:11 -0400 Subject: [PATCH] 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 --- Annex/Version.hs | 4 ++-- CHANGELOG | 9 +++++++++ Upgrade.hs | 18 +++++++++++++----- doc/git-annex.mdwn | 13 +++++++++---- doc/upgrades.mdwn | 7 +++++-- 5 files changed, 38 insertions(+), 13 deletions(-) diff --git a/Annex/Version.hs b/Annex/Version.hs index 958e52a834..c3504cfd93 100644 --- a/Annex/Version.hs +++ b/Annex/Version.hs @@ -19,7 +19,7 @@ import qualified Annex import qualified Data.Map as M defaultVersion :: RepoVersion -defaultVersion = RepoVersion 8 +defaultVersion = RepoVersion 10 latestVersion :: RepoVersion latestVersion = RepoVersion 10 @@ -42,7 +42,7 @@ autoUpgradeableVersions = M.fromList , (RepoVersion 6, defaultVersion) , (RepoVersion 7, defaultVersion) , (RepoVersion 8, defaultVersion) - , (RepoVersion 9, latestVersion) + , (RepoVersion 9, defaultVersion) ] versionField :: ConfigKey diff --git a/CHANGELOG b/CHANGELOG index aefdd7b49b..5def79db9f 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -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 Mon, 25 Jul 2022 15:35:45 -0400 + git-annex (10.20220724) upstream; urgency=medium * filter-process: Fix a bug involving handling of empty files, diff --git a/Upgrade.hs b/Upgrade.hs index 01daa3a327..2073b1bec0 100644 --- a/Upgrade.hs +++ b/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 diff --git a/doc/git-annex.mdwn b/doc/git-annex.mdwn index 34c3ba7f60..a53f7bf7eb 100644 --- a/doc/git-annex.mdwn +++ b/doc/git-annex.mdwn @@ -1181,13 +1181,18 @@ repository, using [[git-annex-config]]. See its man page for a list.) * `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 - 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 - repository. Instead it will exit with an error message. You can run - `git annex upgrade` yourself when you are ready to upgrade the + repository. If the repository version is not supported, git-annex + 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. * `annex.crippledfilesystem` diff --git a/doc/upgrades.mdwn b/doc/upgrades.mdwn index 836f922b85..7d48547d82 100644 --- a/doc/upgrades.mdwn +++ b/doc/upgrades.mdwn @@ -61,12 +61,15 @@ it very unlikely that such a process is still running. ## 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 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. +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 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. 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)