diff --git a/Upgrade/V1.hs b/Upgrade/V1.hs index 850080436f..602ba41c59 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 6cd8a9326b..c40385bebe 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.