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