summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Annex/Version.hs14
-rw-r--r--Command/Direct.hs2
-rw-r--r--Command/Indirect.hs2
-rw-r--r--Command/Version.hs4
-rw-r--r--Init.hs3
-rw-r--r--Upgrade.hs10
-rw-r--r--Upgrade/V1.hs4
-rw-r--r--Upgrade/V4.hs4
-rw-r--r--debian/changelog4
9 files changed, 18 insertions, 29 deletions
diff --git a/Annex/Version.hs b/Annex/Version.hs
index 2b4a49fd2..2a75a1c55 100644
--- a/Annex/Version.hs
+++ b/Annex/Version.hs
@@ -15,24 +15,18 @@ import qualified Annex
type Version = String
-defaultVersion :: Version
-defaultVersion = "3"
-
-directModeVersion :: Version
-directModeVersion = "5"
-
-supportedVersions :: [Version]
-supportedVersions = [defaultVersion, directModeVersion]
+supportedVersion :: Version
+supportedVersion = "5"
upgradableVersions :: [Version]
#ifndef mingw32_HOST_OS
upgradableVersions = ["0", "1", "2", "4"]
#else
-upgradableVersions = ["2", "4"]
+upgradableVersions = ["2", "3", "4"]
#endif
autoUpgradeableVersions :: [Version]
-autoUpgradeableVersions = ["4"]
+autoUpgradeableVersions = ["3", "4"]
versionField :: ConfigKey
versionField = annexConfig "version"
diff --git a/Command/Direct.hs b/Command/Direct.hs
index 1f262bd9f..c35bbdaea 100644
--- a/Command/Direct.hs
+++ b/Command/Direct.hs
@@ -16,7 +16,6 @@ import qualified Git.Command
import qualified Git.LsFiles
import Config
import Annex.Direct
-import Annex.Version
import Annex.Exception
def :: [Command]
@@ -69,5 +68,4 @@ cleanup :: CommandCleanup
cleanup = do
showStart "direct" ""
setDirect True
- setVersion directModeVersion
return True
diff --git a/Command/Indirect.hs b/Command/Indirect.hs
index 8b857e2f6..a8669fe50 100644
--- a/Command/Indirect.hs
+++ b/Command/Indirect.hs
@@ -22,7 +22,6 @@ import Annex.Direct
import Annex.Content
import Annex.Content.Direct
import Annex.CatFile
-import Annex.Version
import Annex.Exception
import Init
import qualified Command.Add
@@ -107,7 +106,6 @@ perform = do
cleanup :: CommandCleanup
cleanup = do
- setVersion defaultVersion
showStart "indirect" ""
showEndOk
return True
diff --git a/Command/Version.hs b/Command/Version.hs
index 13b839e66..0326b9ede 100644
--- a/Command/Version.hs
+++ b/Command/Version.hs
@@ -30,9 +30,7 @@ start = do
liftIO $ do
showPackageVersion
info "local repository version" $ fromMaybe "unknown" v
- info "default repository version" defaultVersion
- info "supported repository versions" $
- unwords supportedVersions
+ info "supported repository version" supportedVersion
info "upgrade supported from repository versions" $
unwords upgradableVersions
stop
diff --git a/Init.hs b/Init.hs
index 759eae763..56bccfa0c 100644
--- a/Init.hs
+++ b/Init.hs
@@ -65,13 +65,12 @@ initialize mdescription = do
checkCrippledFileSystem
unlessM isBare $
hookWrite preCommitHook
+ setVersion supportedVersion
ifM (crippledFileSystem <&&> not <$> isBare)
( do
enableDirectMode
setDirect True
- setVersion directModeVersion
, do
- setVersion defaultVersion
-- Handle case where this repo was cloned from a
-- direct mode repo.
unlessM isBare
diff --git a/Upgrade.hs b/Upgrade.hs
index 7385268e8..8566f0d5d 100644
--- a/Upgrade.hs
+++ b/Upgrade.hs
@@ -11,12 +11,12 @@ module Upgrade where
import Common.Annex
import Annex.Version
-import Config
#ifndef mingw32_HOST_OS
import qualified Upgrade.V0
import qualified Upgrade.V1
#endif
import qualified Upgrade.V2
+import qualified Upgrade.V3
import qualified Upgrade.V4
checkUpgrade :: Version -> Annex ()
@@ -24,7 +24,7 @@ checkUpgrade = maybe noop error <=< needsUpgrade
needsUpgrade :: Version -> Annex (Maybe String)
needsUpgrade v
- | v `elem` supportedVersions = ok
+ | v == supportedVersion = ok
| v `elem` autoUpgradeableVersions = ifM (upgrade True)
( ok
, err "Automatic upgrade failed!"
@@ -40,10 +40,7 @@ upgrade :: Bool -> Annex Bool
upgrade automatic = do
upgraded <- go =<< getVersion
when upgraded $
- ifM isDirect
- ( setVersion directModeVersion
- , setVersion defaultVersion
- )
+ setVersion supportedVersion
return upgraded
where
#ifndef mingw32_HOST_OS
@@ -54,5 +51,6 @@ upgrade automatic = do
go (Just "1") = error "upgrade from v1 on Windows not supported"
#endif
go (Just "2") = Upgrade.V2.upgrade
+ go (Just "3") = Upgrade.V3.upgrade automatic
go (Just "4") = Upgrade.V4.upgrade automatic
go _ = return True
diff --git a/Upgrade/V1.hs b/Upgrade/V1.hs
index 688f4c571..8af4848a1 100644
--- a/Upgrade/V1.hs
+++ b/Upgrade/V1.hs
@@ -53,14 +53,14 @@ upgrade = do
ifM (fromRepo Git.repoIsLocalBare)
( do
moveContent
- setVersion defaultVersion
+ setVersion supportedVersion
, do
moveContent
updateSymlinks
moveLocationLogs
Annex.Queue.flush
- setVersion defaultVersion
+ setVersion supportedVersion
)
Upgrade.V2.upgrade
diff --git a/Upgrade/V4.hs b/Upgrade/V4.hs
index 147ace559..dad073d0b 100644
--- a/Upgrade/V4.hs
+++ b/Upgrade/V4.hs
@@ -11,7 +11,7 @@ import Common.Annex
import Config
import Annex.Direct
-{- Direct mode only upgrade. -}
+{- Direct mode only upgrade. v4 to v5 indirect update is a no-op -}
upgrade :: Bool -> Annex Bool
upgrade automatic = ifM isDirect
( do
@@ -19,5 +19,5 @@ upgrade automatic = ifM isDirect
showAction "v4 to v5"
setDirect True
return True
- , return False
+ , return True
)
diff --git a/debian/changelog b/debian/changelog
index 9692cc56c..cfb8e9309 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -10,6 +10,10 @@ git-annex (5.20131222) UNRELEASED; urgency=medium
* Added new external special remote interface.
* addurl, importfeed: Sanitize | and some other symbols and special
characters.
+ * Auto-upgrade v3 indirect repos to v5 with no changes.
+ This also fixes a problem when a direct mode repo was somehow set to v3
+ rather than v4, and so the automatic direct mode upgrade to v5 was not
+ done.
-- Joey Hess <joeyh@debian.org> Tue, 24 Dec 2013 13:54:32 -0400