Fix upgrade from 0.03.

This commit is contained in:
Joey Hess 2010-12-13 11:35:00 -04:00
parent 67c5036579
commit 0210628263
2 changed files with 18 additions and 1 deletions

View file

@ -7,9 +7,12 @@
module Upgrade where
import System.IO.Error (try)
import System.Directory
import Control.Monad.State (liftIO)
import Control.Monad (filterM)
import System.Posix.Files
import System.FilePath
import Core
import Types
@ -37,7 +40,7 @@ upgradeFrom0 = do
-- do the reorganisation of the files
let olddir = annexDir g
keys <- getKeysPresent' olddir
keys <- getKeysPresent0' olddir
_ <- mapM (\k -> moveAnnex k $ olddir ++ "/" ++ keyFile k) keys
-- update the symlinks to the files
@ -61,3 +64,16 @@ upgradeFrom0 = do
liftIO $ createSymbolicLink link f
Annex.queue "add" ["--"] f
fixlinks fs
getKeysPresent0' :: FilePath -> Annex [Key]
getKeysPresent0' dir = do
contents <- liftIO $ getDirectoryContents dir
files <- liftIO $ filterM present contents
return $ map fileKey files
where
present d = do
result <- try $
getFileStatus $ dir ++ "/" ++ takeFileName d
case result of
Right s -> return $ isRegularFile s
Left _ -> return False

1
debian/changelog vendored
View file

@ -2,6 +2,7 @@ git-annex (0.13) UNRELEASED; urgency=low
* Makefile: Install man page and html (when built).
* Makefile: Add GHCFLAGS variable.
* Fix upgrade from 0.03.
-- Joey Hess <joeyh@debian.org> Sun, 12 Dec 2010 13:14:58 -0400