summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-03-16 10:56:59 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-03-16 11:00:18 -0400
commita0807999001017bd6897bad82e747c16e18af6bc (patch)
tree514691d628a924814c222c08c7a04e24d0dd815c
parent137257ded1acb1b15c0413a8998af1e999cd1a53 (diff)
upgrades seem to fully work
-rw-r--r--Upgrade/V1.hs34
-rw-r--r--debian/changelog9
2 files changed, 39 insertions, 4 deletions
diff --git a/Upgrade/V1.hs b/Upgrade/V1.hs
index 850080436..602ba41c5 100644
--- a/Upgrade/V1.hs
+++ b/Upgrade/V1.hs
@@ -14,9 +14,10 @@ import Control.Monad (filterM, forM_, unless)
import System.Posix.Files
import System.FilePath
import Data.String.Utils
-import Key
import System.Posix.Types
+import Data.Maybe
+import Key
import Content
import Types
import Locations
@@ -94,7 +95,36 @@ updateSymlinks = do
moveLocationLogs :: Annex ()
moveLocationLogs = do
- warning "TODO location log move"
+ logkeys <- oldlocationlogs
+ forM_ logkeys move
+ where
+ oldlocationlogs = do
+ g <- Annex.gitRepo
+ let dir = gitStateDir g
+ contents <- liftIO $ getDirectoryContents dir
+ return $ catMaybes $ map oldlog2key contents
+ move (l, k) = do
+ g <- Annex.gitRepo
+ let dest = logFile g k
+ let dir = gitStateDir g
+ let f = dir </> l
+ liftIO $ createDirectoryIfMissing True (parentDir dest)
+ -- could just git mv, but this way deals with
+ -- log files that are not checked into git
+ liftIO $ copyFile f dest
+ Annex.queue "add" [Param "--"] dest
+ Annex.queue "add" [Param "--"] f
+ Annex.queue "rm" [Param "--quiet", Param "-f", Param "--"] f
+
+oldlog2key :: FilePath -> Maybe (FilePath, Key)
+oldlog2key l =
+ let len = length l - 4 in
+ if drop len l == ".log"
+ then let k = readKey1 (take len l) in
+ if null (keyName k) || null (keyBackendName k)
+ then Nothing
+ else Just (l, k)
+ else Nothing
-- WORM backend keys: "WORM:mtime:size:filename"
-- all the rest: "backend:key"
diff --git a/debian/changelog b/debian/changelog
index 6cd8a9326..c40385beb 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,7 +1,12 @@
git-annex (0.20110316) UNRELEASED; urgency=low
- * TODO: upgrade v1 -> v2
- * Reorganized annexed object store. annex.version=2
+ * Reorganized .git/annex/objects and .git-annex/; annex.version=2
+ * The first time git-annex is run in an old format repository, it
+ will automatically upgrade it to the new format, staging all
+ necessary changes to git.
+ * Note that remotes must be running this version of git-annex,
+ and must also have been upgraded, in order for git-annex to
+ communicate with them.
* Colons are now avoided in filenames, so bare clones of git repos
can be put on USB thumb drives formatted with vFAT or similar
filesystems.