2010-11-08 20:40:42 +00:00
|
|
|
{- git-annex repository versioning
|
|
|
|
-
|
2013-02-26 19:13:10 +00:00
|
|
|
- Copyright 2010,2013 Joey Hess <joey@kitenet.net>
|
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
|
|
|
|
|
|
|
|
defaultVersion :: Version
|
2011-06-21 18:34:08 +00:00
|
|
|
defaultVersion = "3"
|
2011-03-19 18:33:24 +00:00
|
|
|
|
2013-02-26 19:13:10 +00:00
|
|
|
directModeVersion :: Version
|
2013-11-05 20:42:59 +00:00
|
|
|
directModeVersion = "5"
|
2013-02-26 19:13:10 +00:00
|
|
|
|
2011-03-19 18:33:24 +00:00
|
|
|
supportedVersions :: [Version]
|
2013-02-26 19:13:10 +00:00
|
|
|
supportedVersions = [defaultVersion, directModeVersion]
|
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
|
2013-11-05 20:42:59 +00:00
|
|
|
upgradableVersions = ["0", "1", "2", "4"]
|
2013-05-11 20:03:00 +00:00
|
|
|
#else
|
2013-11-05 20:42:59 +00:00
|
|
|
upgradableVersions = ["2", "4"]
|
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]
|
|
|
|
autoUpgradeableVersions = ["4"]
|
|
|
|
|
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
|
|
|
|
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
|