annex.version is now set to 4 for direct mode repositories

To avoid old versions of git-annex getting confused.

There is no upgrade required though.
We switch back to 3 when going from direct to indirect.
This commit is contained in:
Joey Hess 2013-02-26 15:13:10 -04:00
parent 9052efbc22
commit 2d9c046dea
8 changed files with 23 additions and 9 deletions

View file

@ -1,6 +1,6 @@
{- git-annex repository versioning {- git-annex repository versioning
- -
- Copyright 2010 Joey Hess <joey@kitenet.net> - Copyright 2010,2013 Joey Hess <joey@kitenet.net>
- -
- Licensed under the GNU GPL version 3 or higher. - Licensed under the GNU GPL version 3 or higher.
-} -}
@ -16,8 +16,11 @@ type Version = String
defaultVersion :: Version defaultVersion :: Version
defaultVersion = "3" defaultVersion = "3"
directModeVersion :: Version
directModeVersion = "4"
supportedVersions :: [Version] supportedVersions :: [Version]
supportedVersions = [defaultVersion] supportedVersions = [defaultVersion, directModeVersion]
upgradableVersions :: [Version] upgradableVersions :: [Version]
upgradableVersions = ["0", "1", "2"] upgradableVersions = ["0", "1", "2"]
@ -28,8 +31,8 @@ versionField = annexConfig "version"
getVersion :: Annex (Maybe Version) getVersion :: Annex (Maybe Version)
getVersion = annexVersion <$> Annex.getGitConfig getVersion = annexVersion <$> Annex.getGitConfig
setVersion :: Annex () setVersion :: Version -> Annex ()
setVersion = setConfig versionField defaultVersion setVersion = setConfig versionField
removeVersion :: Annex () removeVersion :: Annex ()
removeVersion = unsetConfig versionField removeVersion = unsetConfig versionField

View file

@ -14,6 +14,7 @@ import qualified Git.Command
import qualified Git.LsFiles import qualified Git.LsFiles
import Config import Config
import Annex.Direct import Annex.Direct
import Annex.Version
def :: [Command] def :: [Command]
def = [notBareRepo $ def = [notBareRepo $
@ -53,4 +54,5 @@ cleanup :: CommandCleanup
cleanup = do cleanup = do
showStart "direct" "" showStart "direct" ""
setDirect True setDirect True
setVersion directModeVersion
return True return True

View file

@ -17,6 +17,7 @@ import qualified Annex
import Annex.Direct import Annex.Direct
import Annex.Content import Annex.Content
import Annex.CatFile import Annex.CatFile
import Annex.Version
import Init import Init
def :: [Command] def :: [Command]
@ -88,6 +89,7 @@ perform = do
cleanup :: CommandCleanup cleanup :: CommandCleanup
cleanup = do cleanup = do
setVersion defaultVersion
showStart "indirect" "" showStart "indirect" ""
showEndOk showEndOk
return True return True

View file

@ -23,5 +23,5 @@ start :: CommandStart
start = do start = do
showStart "upgrade" "." showStart "upgrade" "."
r <- upgrade r <- upgrade
setVersion setVersion defaultVersion
next $ next $ return r next $ next $ return r

View file

@ -42,9 +42,9 @@ genDescription Nothing = do
initialize :: Maybe String -> Annex () initialize :: Maybe String -> Annex ()
initialize mdescription = do initialize mdescription = do
prepUUID prepUUID
setVersion defaultVersion
checkCrippledFileSystem checkCrippledFileSystem
Annex.Branch.create Annex.Branch.create
setVersion
gitPreCommitHookWrite gitPreCommitHookWrite
createInodeSentinalFile createInodeSentinalFile
u <- getUUID u <- getUUID
@ -143,3 +143,4 @@ checkCrippledFileSystem = whenM (probeCrippledFileSystem) $ do
maybe noop (`toDirect` f) =<< isAnnexLink f maybe noop (`toDirect` f) =<< isAnnexLink f
void $ liftIO clean void $ liftIO clean
setDirect True setDirect True
setVersion directModeVersion

View file

@ -53,14 +53,14 @@ upgrade = do
ifM (fromRepo Git.repoIsLocalBare) ifM (fromRepo Git.repoIsLocalBare)
( do ( do
moveContent moveContent
setVersion setVersion defaultVersion
, do , do
moveContent moveContent
updateSymlinks updateSymlinks
moveLocationLogs moveLocationLogs
Annex.Queue.flush Annex.Queue.flush
setVersion setVersion defaultVersion
) )
Upgrade.V2.upgrade Upgrade.V2.upgrade

3
debian/changelog vendored
View file

@ -1,5 +1,6 @@
git-annex (3.20130217) UNRELEASED; urgency=low git-annex (4.20130217) UNRELEASED; urgency=low
* annex.version is now set to 4 for direct mode repositories.
* Should now fully support git repositories with core.symlinks=false; * Should now fully support git repositories with core.symlinks=false;
always using git's pseudosymlink files in such repositories. always using git's pseudosymlink files in such repositories.
* webapp: Allow creating repositories on filesystems that lack support for * webapp: Allow creating repositories on filesystems that lack support for

View file

@ -18,6 +18,11 @@ conflicts first before upgrading git-annex.
## Upgrade events, so far ## Upgrade events, so far
### v3 -> v4 (git-annex version 4.x)
v4 is only used for [[direct_mode]], and no upgrade needs to be done from
existing v3 repositories, they will continue to work.
### v2 -> v3 (git-annex version 3.x) ### v2 -> v3 (git-annex version 3.x)
Involved moving the .git-annex/ directory into a separate git-annex branch. Involved moving the .git-annex/ directory into a separate git-annex branch.