git-annex/Upgrade.hs
Joey Hess 944c51ba26 improve version checking for v3
Do not set annex.version whenever any command is run. Just do it in init.
This ensures that, if a repo has annex.version=3, it has a git-annex
branch, so we don't have to run a command every time to check for the
branch.

Remove the old ad-hoc logic for v0 and v1, to simplify version checking.
2011-06-22 18:07:45 -04:00

24 lines
536 B
Haskell

{- git-annex upgrade support
-
- Copyright 2010 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Upgrade where
import Types
import Version
import qualified Upgrade.V0
import qualified Upgrade.V1
import qualified Upgrade.V2
{- Uses the annex.version git config setting to automate upgrades. -}
upgrade :: Annex Bool
upgrade = do
version <- getVersion
case version of
Just "0" -> Upgrade.V0.upgrade
Just "1" -> Upgrade.V1.upgrade
Just "2" -> Upgrade.V2.upgrade
_ -> return True