No longer auto-upgrade to repository format 2, to avoid accidental upgrades, etc. Use git-annex upgrade when you're ready to run this version.
This commit is contained in:
parent
43b3675d42
commit
6a2a17658c
8 changed files with 32 additions and 20 deletions
16
Version.hs
16
Version.hs
|
@ -8,6 +8,7 @@
|
|||
module Version where
|
||||
|
||||
import Control.Monad.State (liftIO)
|
||||
import Control.Monad (unless)
|
||||
import System.Directory
|
||||
|
||||
import Types
|
||||
|
@ -23,6 +24,9 @@ defaultVersion = "2"
|
|||
supportedVersions :: [Version]
|
||||
supportedVersions = [defaultVersion]
|
||||
|
||||
upgradableVersions :: [Version]
|
||||
upgradableVersions = ["0", "1"]
|
||||
|
||||
versionField :: String
|
||||
versionField = "annex.version"
|
||||
|
||||
|
@ -51,3 +55,15 @@ getVersion = do
|
|||
|
||||
setVersion :: Annex ()
|
||||
setVersion = Annex.setConfig versionField defaultVersion
|
||||
|
||||
checkVersion :: Annex ()
|
||||
checkVersion = do
|
||||
v <- getVersion
|
||||
unless (v `elem` supportedVersions) $ do
|
||||
error $ "Repository version " ++ v ++
|
||||
" is not supported. " ++
|
||||
msg v
|
||||
where
|
||||
msg v
|
||||
| v `elem` upgradableVersions = "Upgrade this repository: git-annex upgrade"
|
||||
| otherwise = "Upgrade git-annex."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue