git-annex/Upgrade.hs
2013-05-11 23:54:25 -04:00

31 lines
686 B
Haskell

{- git-annex upgrade support
-
- Copyright 2010 Joey Hess <joey@kitenet.net>
-
- Licensed under the GNU GPL version 3 or higher.
-}
{-# LANGUAGE CPP #-}
module Upgrade where
import Common.Annex
import Annex.Version
#ifndef __WINDOWS__
import qualified Upgrade.V0
import qualified Upgrade.V1
#endif
import qualified Upgrade.V2
upgrade :: Annex Bool
upgrade = go =<< getVersion
where
#ifndef __WINDOWS__
go (Just "0") = Upgrade.V0.upgrade
go (Just "1") = Upgrade.V1.upgrade
#else
go (Just "0") = error "upgrade from v0 on Windows not supported"
go (Just "1") = error "upgrade from v1 on Windows not supported"
#endif
go (Just "2") = Upgrade.V2.upgrade
go _ = return True