fix autoupgrade from v6 to go to v7, not v5
v3 and v4 still autoupgrade to v5 And a few more upgrade doc updates.
This commit is contained in:
parent
234842a347
commit
b996b38b4f
4 changed files with 25 additions and 10 deletions
|
@ -14,6 +14,8 @@ import Config
|
|||
import Types.RepoVersion
|
||||
import qualified Annex
|
||||
|
||||
import qualified Data.Map as M
|
||||
|
||||
defaultVersion :: RepoVersion
|
||||
defaultVersion = RepoVersion 5
|
||||
|
||||
|
@ -33,8 +35,12 @@ upgradableVersions = map RepoVersion [0..6]
|
|||
upgradableVersions = map RepoVersion [2..6]
|
||||
#endif
|
||||
|
||||
autoUpgradeableVersions :: [RepoVersion]
|
||||
autoUpgradeableVersions = map RepoVersion [3, 4, 6]
|
||||
autoUpgradeableVersions :: M.Map RepoVersion RepoVersion
|
||||
autoUpgradeableVersions = M.fromList
|
||||
[ (RepoVersion 3, RepoVersion 5)
|
||||
, (RepoVersion 4, RepoVersion 5)
|
||||
, (RepoVersion 6, RepoVersion 7)
|
||||
]
|
||||
|
||||
versionField :: ConfigKey
|
||||
versionField = annexConfig "version"
|
||||
|
|
|
@ -3,6 +3,9 @@ git-annex (7.20181025) UNRELEASED; urgency=medium
|
|||
* Added v7 repository mode. v6 upgrades automatically to v7, but
|
||||
v5 is still the default for now. While v6 was always experimental
|
||||
to some degree, its successor v7 is ready for production use!
|
||||
* Direct mode repositories are deprecated; they have many problems
|
||||
that v7 fixes, so upgrading them now is recommended (but not yet
|
||||
required): git annex upgrade --version=7
|
||||
* At long last there's a way to hide annexed files whose content
|
||||
is missing from the working tree: git-annex adjust --hide-missing
|
||||
See https://git-annex.branchable.com/tips/hiding_missing_files/
|
||||
|
|
18
Upgrade.hs
18
Upgrade.hs
|
@ -22,18 +22,24 @@ import qualified Upgrade.V4
|
|||
import qualified Upgrade.V5
|
||||
import qualified Upgrade.V6
|
||||
|
||||
import qualified Data.Map as M
|
||||
|
||||
checkUpgrade :: RepoVersion -> Annex ()
|
||||
checkUpgrade = maybe noop giveup <=< needsUpgrade
|
||||
|
||||
needsUpgrade :: RepoVersion -> Annex (Maybe String)
|
||||
needsUpgrade v
|
||||
| v `elem` supportedVersions = ok
|
||||
| v `elem` autoUpgradeableVersions = ifM (upgrade True defaultVersion)
|
||||
( ok
|
||||
, err "Automatic upgrade failed!"
|
||||
)
|
||||
| v `elem` upgradableVersions = err "Upgrade this repository: git-annex upgrade"
|
||||
| otherwise = err "Upgrade git-annex."
|
||||
| otherwise = case M.lookup v autoUpgradeableVersions of
|
||||
Nothing
|
||||
| v `elem` upgradableVersions ->
|
||||
err "Upgrade this repository: git-annex upgrade"
|
||||
| otherwise ->
|
||||
err "Upgrade git-annex."
|
||||
Just newv -> ifM (upgrade True newv)
|
||||
( ok
|
||||
, err "Automatic upgrade failed!"
|
||||
)
|
||||
where
|
||||
err msg = return $ Just $ "Repository version " ++
|
||||
show (fromRepoVersion v) ++
|
||||
|
|
|
@ -11,9 +11,9 @@ understand how to update its working tree.
|
|||
|
||||
## deprecated
|
||||
|
||||
Direct mode is deprecated! Intead, git-annex v6 repositories can simply
|
||||
Direct mode is deprecated! Intead, git-annex v7 repositories can simply
|
||||
have files that are unlocked and thus can be directly accessed and
|
||||
modified. See [[upgrades]] for details about the transition to v6
|
||||
modified. See [[upgrades]] for details about the transition to v7
|
||||
repositories.
|
||||
|
||||
## enabling (and disabling) direct mode
|
||||
|
|
Loading…
Reference in a new issue