summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CmdLine.hs5
-rw-r--r--Command/Version.hs1
-rw-r--r--Upgrade.hs6
-rw-r--r--Version.hs16
-rw-r--r--debian/NEWS5
-rw-r--r--debian/changelog3
-rw-r--r--doc/forum/Is_an_automagic_upgrade_of_the_object_directory_safe__63__/comment_1_c25900b9d2d62cc0b8c77150bcfebadf._comment3
-rw-r--r--doc/upgrades.mdwn13
8 files changed, 32 insertions, 20 deletions
diff --git a/CmdLine.hs b/CmdLine.hs
index 0698f2f5e..6b4fd0f36 100644
--- a/CmdLine.hs
+++ b/CmdLine.hs
@@ -22,7 +22,7 @@ import qualified GitQueue
import Types
import Command
import BackendList
-import Upgrade
+import Version
import Options
import Messages
import UUID
@@ -33,7 +33,7 @@ dispatch gitrepo args cmds options header = do
setupConsole
state <- Annex.new gitrepo allBackends
(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
- list of actions to be run in the Annex monad. -}
@@ -93,6 +93,7 @@ tryRun' _ errnum [] = do
startup :: Annex Bool
startup = do
prepUUID
+ checkVersion
return True
{- Cleanup actions. -}
diff --git a/Command/Version.hs b/Command/Version.hs
index 480f2166b..ac8fdd48c 100644
--- a/Command/Version.hs
+++ b/Command/Version.hs
@@ -13,7 +13,6 @@ import Data.String.Utils
import Command
import qualified SysConfig
import Version
-import Upgrade
command :: [Command]
command = [Command "version" paramNothing seek "show versions"]
diff --git a/Upgrade.hs b/Upgrade.hs
index d201cc73e..08481755f 100644
--- a/Upgrade.hs
+++ b/Upgrade.hs
@@ -12,9 +12,6 @@ import Version
import qualified Upgrade.V0
import qualified Upgrade.V1
-upgradableVersions :: [Version]
-upgradableVersions = ["0", "1"]
-
{- Uses the annex.version git config setting to automate upgrades. -}
upgrade :: Annex Bool
upgrade = do
@@ -22,5 +19,4 @@ upgrade = do
case version of
"0" -> Upgrade.V0.upgrade
"1" -> Upgrade.V1.upgrade
- v | v `elem` supportedVersions -> return True
- _ -> error "this version of git-annex is too old for this git repository!"
+ _ -> return True
diff --git a/Version.hs b/Version.hs
index d4a58d77a..d061a2eab 100644
--- a/Version.hs
+++ b/Version.hs
@@ -8,6 +8,7 @@
module Version where
import Control.Monad.State (liftIO)
+import Control.Monad (unless)
import System.Directory
import Types
@@ -23,6 +24,9 @@ defaultVersion = "2"
supportedVersions :: [Version]
supportedVersions = [defaultVersion]
+upgradableVersions :: [Version]
+upgradableVersions = ["0", "1"]
+
versionField :: String
versionField = "annex.version"
@@ -51,3 +55,15 @@ getVersion = do
setVersion :: Annex ()
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."
diff --git a/debian/NEWS b/debian/NEWS
index df8518cef..a8b258bfe 100644
--- a/debian/NEWS
+++ b/debian/NEWS
@@ -2,10 +2,7 @@ git-annex (0.20110316) experimental; urgency=low
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
- to this version. While git-annex will attempt to transparently handle
- upgrades, you may want to drive the upgrade process by hand.
-
- See <http://git-annex.branchable.com/upgrades/> or
+ to this version. See <http://git-annex.branchable.com/upgrades/> or
/usr/share/doc/git-annex/html/upgrades.html
-- Joey Hess <joeyh@debian.org> Wed, 16 Mar 2011 15:49:15 -0400
diff --git a/debian/changelog b/debian/changelog
index 751fcaff9..032dedfb9 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,9 @@ git-annex (0.20110317) UNRELEASED; urgency=low
* Fix support for remotes with '.' in their names.
* Add version command to show git-annex version as well as repository
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
diff --git a/doc/forum/Is_an_automagic_upgrade_of_the_object_directory_safe__63__/comment_1_c25900b9d2d62cc0b8c77150bcfebadf._comment b/doc/forum/Is_an_automagic_upgrade_of_the_object_directory_safe__63__/comment_1_c25900b9d2d62cc0b8c77150bcfebadf._comment
index 6a34becd3..8420d7bb3 100644
--- a/doc/forum/Is_an_automagic_upgrade_of_the_object_directory_safe__63__/comment_1_c25900b9d2d62cc0b8c77150bcfebadf._comment
+++ b/doc/forum/Is_an_automagic_upgrade_of_the_object_directory_safe__63__/comment_1_c25900b9d2d62cc0b8c77150bcfebadf._comment
@@ -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.
(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.
"""]]
diff --git a/doc/upgrades.mdwn b/doc/upgrades.mdwn
index 1bd97c46e..5c2187c89 100644
--- a/doc/upgrades.mdwn
+++ b/doc/upgrades.mdwn
@@ -9,15 +9,14 @@ git-annex, and might want to use them with a newer git-annex.
## Upgrade process
-git-annex will automatically notice if it is run in a repository that
-needs an upgrade, and perform the upgrade before running whatever it
-was asked to do. Or you can use the "git annex upgrade" command to
-explicitly do an upgrade. The upgrade can tend to take a while,
-if you have a lot of files.
+git-annex will notice if it is run in a repository that
+needs an upgrade, and refuse to do anything. To upgrade,
+use the "git annex upgrade" command. The upgrade can tend
+to take a while, if you have a lot of files.
Each clone of a repository should be individually upgraded.
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
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/.
And .gitattributes needed to have another line added to it.
-Handled transparently.
-
### v0 -> v1 (git-annex version 0.03 to version 0.04)
Involved a reorganisation of the layout of .git/annex/. Symlinks changed.