No longer auto-upgrade to repository format 2, to avoid accidental upgrades, etc. Use git-annex upgrade when you're ready to run this version.

This commit is contained in:
Joey Hess 2011-03-19 18:33:39 -04:00
parent 43b3675d42
commit 6a2a17658c
8 changed files with 32 additions and 20 deletions

View file

@ -22,7 +22,7 @@ import qualified GitQueue
import Types import Types
import Command import Command
import BackendList import BackendList
import Upgrade import Version
import Options import Options
import Messages import Messages
import UUID import UUID
@ -33,7 +33,7 @@ dispatch gitrepo args cmds options header = do
setupConsole setupConsole
state <- Annex.new gitrepo allBackends state <- Annex.new gitrepo allBackends
(actions, state') <- Annex.run state $ parseCmd args header cmds options (actions, state') <- Annex.run state $ parseCmd args header cmds options
tryRun state' $ [startup, upgrade] ++ actions ++ [shutdown] tryRun state' $ [startup] ++ actions ++ [shutdown]
{- Parses command line, stores configure flags, and returns a {- Parses command line, stores configure flags, and returns a
- list of actions to be run in the Annex monad. -} - list of actions to be run in the Annex monad. -}
@ -93,6 +93,7 @@ tryRun' _ errnum [] = do
startup :: Annex Bool startup :: Annex Bool
startup = do startup = do
prepUUID prepUUID
checkVersion
return True return True
{- Cleanup actions. -} {- Cleanup actions. -}

View file

@ -13,7 +13,6 @@ import Data.String.Utils
import Command import Command
import qualified SysConfig import qualified SysConfig
import Version import Version
import Upgrade
command :: [Command] command :: [Command]
command = [Command "version" paramNothing seek "show versions"] command = [Command "version" paramNothing seek "show versions"]

View file

@ -12,9 +12,6 @@ import Version
import qualified Upgrade.V0 import qualified Upgrade.V0
import qualified Upgrade.V1 import qualified Upgrade.V1
upgradableVersions :: [Version]
upgradableVersions = ["0", "1"]
{- Uses the annex.version git config setting to automate upgrades. -} {- Uses the annex.version git config setting to automate upgrades. -}
upgrade :: Annex Bool upgrade :: Annex Bool
upgrade = do upgrade = do
@ -22,5 +19,4 @@ upgrade = do
case version of case version of
"0" -> Upgrade.V0.upgrade "0" -> Upgrade.V0.upgrade
"1" -> Upgrade.V1.upgrade "1" -> Upgrade.V1.upgrade
v | v `elem` supportedVersions -> return True _ -> return True
_ -> error "this version of git-annex is too old for this git repository!"

View file

@ -8,6 +8,7 @@
module Version where module Version where
import Control.Monad.State (liftIO) import Control.Monad.State (liftIO)
import Control.Monad (unless)
import System.Directory import System.Directory
import Types import Types
@ -23,6 +24,9 @@ defaultVersion = "2"
supportedVersions :: [Version] supportedVersions :: [Version]
supportedVersions = [defaultVersion] supportedVersions = [defaultVersion]
upgradableVersions :: [Version]
upgradableVersions = ["0", "1"]
versionField :: String versionField :: String
versionField = "annex.version" versionField = "annex.version"
@ -51,3 +55,15 @@ getVersion = do
setVersion :: Annex () setVersion :: Annex ()
setVersion = Annex.setConfig versionField defaultVersion setVersion = Annex.setConfig versionField defaultVersion
checkVersion :: Annex ()
checkVersion = do
v <- getVersion
unless (v `elem` supportedVersions) $ do
error $ "Repository version " ++ v ++
" is not supported. " ++
msg v
where
msg v
| v `elem` upgradableVersions = "Upgrade this repository: git-annex upgrade"
| otherwise = "Upgrade git-annex."

5
debian/NEWS vendored
View file

@ -2,10 +2,7 @@ git-annex (0.20110316) experimental; urgency=low
This version reorganises the layout of git-annex's files in your repository. This version reorganises the layout of git-annex's files in your repository.
There is an upgrade process to convert a repository from the old git-annex There is an upgrade process to convert a repository from the old git-annex
to this version. While git-annex will attempt to transparently handle to this version. See <http://git-annex.branchable.com/upgrades/> or
upgrades, you may want to drive the upgrade process by hand.
See <http://git-annex.branchable.com/upgrades/> or
/usr/share/doc/git-annex/html/upgrades.html /usr/share/doc/git-annex/html/upgrades.html
-- Joey Hess <joeyh@debian.org> Wed, 16 Mar 2011 15:49:15 -0400 -- Joey Hess <joeyh@debian.org> Wed, 16 Mar 2011 15:49:15 -0400

3
debian/changelog vendored
View file

@ -4,6 +4,9 @@ git-annex (0.20110317) UNRELEASED; urgency=low
* Fix support for remotes with '.' in their names. * Fix support for remotes with '.' in their names.
* Add version command to show git-annex version as well as repository * Add version command to show git-annex version as well as repository
version information. version information.
* No longer auto-upgrade to repository format 2, to avoid accidental
upgrades, etc. Use git-annex upgrade when you're ready to run this
version.
-- Joey Hess <joeyh@debian.org> Thu, 17 Mar 2011 11:46:53 -0400 -- Joey Hess <joeyh@debian.org> Thu, 17 Mar 2011 11:46:53 -0400

View file

@ -7,4 +7,7 @@
These are good examples; I think you've convinced me at least for upgrades going forward after v2. I'm not sure we have enough users and outdated git-annex installations to worry about it for v1. These are good examples; I think you've convinced me at least for upgrades going forward after v2. I'm not sure we have enough users and outdated git-annex installations to worry about it for v1.
(Hoping such upgrades are rare anyway.. Part of the point of changes made in v2 was to allow lots of changes to be made later w/o needing a v3.) (Hoping such upgrades are rare anyway.. Part of the point of changes made in v2 was to allow lots of changes to be made later w/o needing a v3.)
Update: Upgrades from v1 to v2 will no longer be handled automatically
now.
"""]] """]]

View file

@ -9,15 +9,14 @@ git-annex, and might want to use them with a newer git-annex.
## Upgrade process ## Upgrade process
git-annex will automatically notice if it is run in a repository that git-annex will notice if it is run in a repository that
needs an upgrade, and perform the upgrade before running whatever it needs an upgrade, and refuse to do anything. To upgrade,
was asked to do. Or you can use the "git annex upgrade" command to use the "git annex upgrade" command. The upgrade can tend
explicitly do an upgrade. The upgrade can tend to take a while, to take a while, if you have a lot of files.
if you have a lot of files.
Each clone of a repository should be individually upgraded. Each clone of a repository should be individually upgraded.
Until a repository's remotes have been upgraded, git-annex Until a repository's remotes have been upgraded, git-annex
may refuse to communicate with them. will refuse to communicate with them.
Generally, start by upgrading one repository, and then you can commit Generally, start by upgrading one repository, and then you can commit
the changes git-annex staged during upgrade, and push them out to other the changes git-annex staged during upgrade, and push them out to other
@ -54,8 +53,6 @@ Symlinks changed.
Also, hashing was added to location log files in .git-annex/. Also, hashing was added to location log files in .git-annex/.
And .gitattributes needed to have another line added to it. And .gitattributes needed to have another line added to it.
Handled transparently.
### v0 -> v1 (git-annex version 0.03 to version 0.04) ### v0 -> v1 (git-annex version 0.03 to version 0.04)
Involved a reorganisation of the layout of .git/annex/. Symlinks changed. Involved a reorganisation of the layout of .git/annex/. Symlinks changed.