snap --version= to auto-upgrade
This makes --version=6 still work, despite v6 not being in supportedVersions. Which is useful for scripts that use it. I didn't document it on the man page, because it's indistinguishable from an automatic upgrade after initting as v6.
This commit is contained in:
parent
636f4a68a9
commit
9f87133bf5
2 changed files with 7 additions and 1 deletions
|
@ -42,6 +42,8 @@ git-annex (7.20181025) UNRELEASED; urgency=medium
|
||||||
get confused about whether a locked file's content was present.
|
get confused about whether a locked file's content was present.
|
||||||
* Fix concurrency bug that occurred on the first download from an
|
* Fix concurrency bug that occurred on the first download from an
|
||||||
exporttree remote.
|
exporttree remote.
|
||||||
|
* init --version=6 will still work, but the repository is auto-upgraded
|
||||||
|
immediately to v7.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Sat, 13 Oct 2018 00:52:02 -0400
|
-- Joey Hess <id@joeyh.name> Sat, 13 Oct 2018 00:52:02 -0400
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@ import Annex.Init
|
||||||
import Annex.Version
|
import Annex.Version
|
||||||
import Types.RepoVersion
|
import Types.RepoVersion
|
||||||
import qualified Annex.SpecialRemote
|
import qualified Annex.SpecialRemote
|
||||||
|
|
||||||
|
import qualified Data.Map as M
|
||||||
|
|
||||||
cmd :: Command
|
cmd :: Command
|
||||||
cmd = dontCheck repoExists $
|
cmd = dontCheck repoExists $
|
||||||
|
@ -36,7 +38,9 @@ parseRepoVersion s = case RepoVersion <$> readish s of
|
||||||
Nothing -> fail $ "version parse error"
|
Nothing -> fail $ "version parse error"
|
||||||
Just v
|
Just v
|
||||||
| v `elem` supportedVersions -> return v
|
| v `elem` supportedVersions -> return v
|
||||||
| otherwise -> fail $ s ++ " is not a currently supported repository version"
|
| otherwise -> case M.lookup v autoUpgradeableVersions of
|
||||||
|
Just v' -> return v'
|
||||||
|
Nothing -> fail $ s ++ " is not a currently supported repository version"
|
||||||
|
|
||||||
seek :: InitOptions -> CommandSeek
|
seek :: InitOptions -> CommandSeek
|
||||||
seek = commandAction . start
|
seek = commandAction . start
|
||||||
|
|
Loading…
Reference in a new issue