git-annex/Command/Upgrade.hs

31 lines
765 B
Haskell
Raw Normal View History

2011-03-16 19:48:26 +00:00
{- git-annex command
-
- Copyright 2011 Joey Hess <id@joeyh.name>
2011-03-16 19:48:26 +00:00
-
- Licensed under the GNU GPL version 3 or higher.
-}
module Command.Upgrade where
import Command
2011-03-19 22:58:10 +00:00
import Upgrade
2016-03-31 21:20:43 +00:00
import Annex.Version
import Annex.Init
2011-03-16 19:48:26 +00:00
cmd :: Command
cmd = dontCheck repoExists $ -- because an old version may not seem to exist
2015-12-15 19:34:28 +00:00
noDaemonRunning $ -- avoid upgrading repo out from under daemon
command "upgrade" SectionMaintenance "upgrade repository layout"
paramNothing (withParams seek)
2011-03-16 19:48:26 +00:00
seek :: CmdParams -> CommandSeek
seek = withNothing (commandAction start)
2011-03-16 19:48:26 +00:00
start :: CommandStart
2011-03-16 19:48:26 +00:00
start = do
showStart' "upgrade" Nothing
2016-03-31 21:20:43 +00:00
whenM (isNothing <$> getVersion) $ do
initialize (AutoInit False) Nothing Nothing
r <- upgrade False latestVersion
2011-05-15 06:02:46 +00:00
next $ next $ return r