add v6; keep v5 working for now and manual upgrade
authorJoey Hess <joeyh@joeyh.name>
Fri, 4 Dec 2015 20:14:48 +0000 (16:14 -0400)
committerJoey Hess <joeyh@joeyh.name>
Fri, 4 Dec 2015 20:14:48 +0000 (16:14 -0400)
Since all places where a repo is used in direct mode need to have git-annex
upgraded before the repo can safely be converted to v6, the upgrade needs
to be manual for now.

I suppose that at some point I'll want to drop all the direct mode support
code. At that point, will stop supporting v5, and will need to auto-upgrade
any remaining v5 repos. If possible, I'd like to carry the direct mode
support for say, a year or so, to give people plenty of time to upgrade and
avoid disruption.

Annex/Version.hs
Command/Version.hs
Upgrade.hs
Upgrade/V1.hs
Upgrade/V5.hs [new file with mode: 0644]
debian/changelog
doc/git-annex-smudge.mdwn
doc/todo/smudge.mdwn
doc/upgrades.mdwn

index d08f994e95ac3e7693dc2eac7aa045c70b0d2981..e1983fc67a2463b11ac52a161e02621cfd45b032 100644 (file)
@@ -15,14 +15,17 @@ import qualified Annex
 
 type Version = String
 
-supportedVersion :: Version
-supportedVersion = "5"
+currentVersion :: Version
+currentVersion = "6"
+
+supportedVersions :: [Version]
+supportedVersions = ["5", currentVersion]
 
 upgradableVersions :: [Version]
 #ifndef mingw32_HOST_OS
-upgradableVersions = ["0", "1", "2", "4"]
+upgradableVersions = ["0", "1", "2", "4", "5"]
 #else
-upgradableVersions = ["2", "3", "4"]
+upgradableVersions = ["2", "3", "4", "5"]
 #endif
 
 autoUpgradeableVersions :: [Version]
index 72bbe40648044c20a54418434f333c3f2991f26f..c5a9fcef2a8d73ea8ca9b806c5517777b8b9f01c 100644 (file)
@@ -50,7 +50,8 @@ showVersion = do
        liftIO $ do
                showPackageVersion
                vinfo "local repository version" $ fromMaybe "unknown" v
-               vinfo "supported repository version" supportedVersion
+               vinfo "supported repository versions" $
+                       unwords supportedVersions
                vinfo "upgrade supported from repository versions" $
                        unwords upgradableVersions
 
index 8d205a874a4b2b7c4902a61ada5821fd1c81e16b..1f4a8d8dec3f1c0b1f8985f14a178d7f33a1beaa 100644 (file)
@@ -18,13 +18,14 @@ import qualified Upgrade.V1
 import qualified Upgrade.V2
 import qualified Upgrade.V3
 import qualified Upgrade.V4
+import qualified Upgrade.V5
 
 checkUpgrade :: Version -> Annex ()
 checkUpgrade = maybe noop error <=< needsUpgrade
 
 needsUpgrade :: Version -> Annex (Maybe String)
 needsUpgrade v
-       | v == supportedVersion = ok
+       | v `elem` supportedVersions = ok
        | v `elem` autoUpgradeableVersions = ifM (upgrade True)
                ( ok
                , err "Automatic upgrade failed!"
@@ -40,7 +41,7 @@ upgrade :: Bool -> Annex Bool
 upgrade automatic = do
        upgraded <- go =<< getVersion
        when upgraded $
-               setVersion supportedVersion
+               setVersion currentVersion
        return upgraded
   where
 #ifndef mingw32_HOST_OS
@@ -53,4 +54,5 @@ upgrade automatic = do
        go (Just "2") = Upgrade.V2.upgrade
        go (Just "3") = Upgrade.V3.upgrade automatic
        go (Just "4") = Upgrade.V4.upgrade automatic
+       go (Just "5") = Upgrade.V5.upgrade automatic
        go _ = return True
index 801cdafa0d64bba55e0b20a22f4d1a0f0f6c7f2f..bcf7e0b6de0f50033805b1aff292a4d48d4e4696 100644 (file)
@@ -54,14 +54,14 @@ upgrade = do
        ifM (fromRepo Git.repoIsLocalBare)
                ( do
                        moveContent
-                       setVersion supportedVersion
+                       setVersion currentVersion
                , do
                        moveContent
                        updateSymlinks
                        moveLocationLogs
        
                        Annex.Queue.flush
-                       setVersion supportedVersion
+                       setVersion currentVersion
                )
        
        Upgrade.V2.upgrade
diff --git a/Upgrade/V5.hs b/Upgrade/V5.hs
new file mode 100644 (file)
index 0000000..cf273bb
--- /dev/null
@@ -0,0 +1,18 @@
+{- git-annex v5 -> v6 uppgrade support
+ -
+ - Copyright 2015 Joey Hess <id@joeyh.name>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+module Upgrade.V5 where
+
+import Common.Annex
+import Config
+
+upgrade :: Bool -> Annex Bool
+upgrade automatic = do
+       unless automatic $
+               showAction "v5 to v6"
+       configureSmudgeFilter
+       return True
index fae4b598b4c6de56dcf0613e58250f1e46363170..f19a22b3eb54980e7bb6c88518636de630dce9c9 100644 (file)
@@ -1,5 +1,11 @@
-git-annex (5.20151117) UNRELEASED; urgency=medium
-
+git-annex (6.20151117) UNRELEASED; urgency=medium
+
+  * annex.version increased to 6, but version 5 is also still supported.
+  * The upgrade to version 6 is not done fully automatically, because
+    upgrading a direct mode repository to version 6 will prevent old
+    versions of git-annex from working in that repository.
+  * smudge: New command, used for git smudge filter. 
+    This will replace direct mode.
   * Build with -j1 again to get reproducible build.
   * Display progress meter in -J mode when copying from a local git repo,
     to a local git repo, and from a remote git repo.
index a4f458ee510dcd84a506e155056a910c3a48d318..5186d2a178321207b35c1f09264cb5538e6a10e6 100644 (file)
@@ -17,8 +17,8 @@ but this is normally set up for you by git-annex init, so you should
 not need to configure it manually:
 
        [filter "annex"]
-               clean = git-annex smudge --clean %f
                smudge = git-annex smudge %f
+               clean = git-annex smudge --clean %f
 
 To make git use this filter on all files except for dotfiles, put something
 like the following in the .gitattributes file:
index 094b5f880f45a6a6cf97a44c7a976058aeadeea9..6e6af6f65b15726fc7d60aafb81a8465c6e856e8 100644 (file)
@@ -308,15 +308,17 @@ annex.version changes to 6
 
 Upgrade should be handled automatically.
 
-On upgrade, update .gitattributes with a stock configuration, unless
-it already mentions "filter=annex".
+On upgrade, update $GIT_DIR/info/attributes with a stock configuration,
+unless it already mentions "filter=annex".
 
 Upgrading a direct mode repo needs to switch it out of bare mode, and
 needs to run `git annex unlock` on all files (or reach the same result).
 So will need to stage changes to all annexed files.
 
 When a repo has some clones indirect and some direct, the upgraded repo
-will have all files unlocked, necessarily in all clones.
+will have all files unlocked, necessarily in all clones. This happens
+automatically, because when the direct repos are upgraded that causes the
+files to be unlocked, while the indirect upgrades don't touch the files.
 
 ----
 
index f5e9cbc3a6f2627262332d99f19592c095c8c591..7600d8e1443ccca5e3a112b1683025d7337e010c 100644 (file)
@@ -43,6 +43,34 @@ conflicts first before upgrading git-annex.
 
 The upgrade events, so far:
 
+## v5 -> v6 (git-annex version 6.x)
+
+The upgrade from v5 to v6 is handled manually. Run `git-annex upgrade`
+perform the upgrade.
+
+All places that a direct mode repository is cloned to should be 
+running git-annex version 6.x before you upgrade the repository.
+This is necessary because the contents of the repository are changed
+in the upgrade, and the old version of git-annex won't be able to
+access files after the repo is upgraded.
+
+If a repository is only used in indirect mode, this upgrade will not
+affect it significantly. You can use git-annex v5 and v6 in different
+clones of the same indirect mode repository without problems.
+
+This upgrade does away with the direct mode/indirect mode distinction.
+A v6 git-annex repository can have some files locked and other files
+unlocked, and all git and git-annex commands can be used on both locked and
+unlocked files. (Although for locked files to work, the filesystem
+must support symbolic links..)
+
+On upgrade, all files in a direct mode repository will be converted to
+unlocked files. The upgrade will need to stage changes to all files in
+the git repository.
+
+If a repository has some clones using direct mode and some using indirect
+mode, all the files will end up unlocked in all clones after the upgrade.
+
 ## v4 -> v5 (git-annex version 5.x)
 
 The upgrade from v4 to v5 is handled