2010-11-08 20:40:42 +00:00
|
|
|
{- git-annex repository versioning
|
|
|
|
-
|
2015-01-21 16:50:09 +00:00
|
|
|
- Copyright 2010,2013 Joey Hess <id@joeyh.name>
|
2010-11-08 20:40:42 +00:00
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2013-05-11 20:03:00 +00:00
|
|
|
{-# LANGUAGE CPP #-}
|
|
|
|
|
2011-10-04 04:40:47 +00:00
|
|
|
module Annex.Version where
|
2010-11-08 20:40:42 +00:00
|
|
|
|
2011-10-05 20:02:51 +00:00
|
|
|
import Common.Annex
|
2011-03-28 01:43:25 +00:00
|
|
|
import Config
|
2013-01-01 17:52:47 +00:00
|
|
|
import qualified Annex
|
2010-11-08 20:40:42 +00:00
|
|
|
|
2011-03-19 18:33:24 +00:00
|
|
|
type Version = String
|
|
|
|
|
2015-12-15 21:17:13 +00:00
|
|
|
defaultVersion :: Version
|
|
|
|
defaultVersion = "5"
|
|
|
|
|
|
|
|
latestVersion :: Version
|
|
|
|
latestVersion = "6"
|
2015-12-04 20:14:48 +00:00
|
|
|
|
|
|
|
supportedVersions :: [Version]
|
2015-12-15 21:17:13 +00:00
|
|
|
supportedVersions = ["5", "6"]
|
2010-11-08 20:40:42 +00:00
|
|
|
|
2011-03-19 22:33:39 +00:00
|
|
|
upgradableVersions :: [Version]
|
2013-08-02 16:27:32 +00:00
|
|
|
#ifndef mingw32_HOST_OS
|
2015-12-04 20:14:48 +00:00
|
|
|
upgradableVersions = ["0", "1", "2", "4", "5"]
|
2013-05-11 20:03:00 +00:00
|
|
|
#else
|
2015-12-04 20:14:48 +00:00
|
|
|
upgradableVersions = ["2", "3", "4", "5"]
|
2013-05-11 20:03:00 +00:00
|
|
|
#endif
|
2011-03-19 22:33:39 +00:00
|
|
|
|
2013-11-05 20:42:59 +00:00
|
|
|
autoUpgradeableVersions :: [Version]
|
2013-12-29 17:06:23 +00:00
|
|
|
autoUpgradeableVersions = ["3", "4"]
|
2013-11-05 20:42:59 +00:00
|
|
|
|
2012-05-06 00:15:32 +00:00
|
|
|
versionField :: ConfigKey
|
|
|
|
versionField = annexConfig "version"
|
2010-11-08 20:40:42 +00:00
|
|
|
|
2011-06-22 22:07:45 +00:00
|
|
|
getVersion :: Annex (Maybe Version)
|
2013-01-01 17:52:47 +00:00
|
|
|
getVersion = annexVersion <$> Annex.getGitConfig
|
2010-11-08 20:40:42 +00:00
|
|
|
|
2015-12-04 20:29:27 +00:00
|
|
|
versionSupportsDirectMode :: Annex Bool
|
|
|
|
versionSupportsDirectMode = go <$> getVersion
|
|
|
|
where
|
|
|
|
go (Just "6") = False
|
|
|
|
go _ = True
|
|
|
|
|
2015-12-09 19:18:25 +00:00
|
|
|
versionSupportsUnlockedPointers :: Annex Bool
|
|
|
|
versionSupportsUnlockedPointers = go <$> getVersion
|
|
|
|
where
|
|
|
|
go (Just "6") = True
|
|
|
|
go _ = False
|
|
|
|
|
2013-02-26 19:13:10 +00:00
|
|
|
setVersion :: Version -> Annex ()
|
|
|
|
setVersion = setConfig versionField
|
2011-03-19 22:33:39 +00:00
|
|
|
|
2012-10-07 20:04:03 +00:00
|
|
|
removeVersion :: Annex ()
|
|
|
|
removeVersion = unsetConfig versionField
|