summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2010-12-13 11:35:00 -0400
committerGravatar Joey Hess <joey@kitenet.net>2010-12-13 11:35:00 -0400
commit0210628263f5a9da4f7ceb6b359108174ac01182 (patch)
treea4eb2759362ff45f78b5e69c032d4d1fe9475009
parent67c5036579a4c4af99711cba45ffffb032262d60 (diff)
Fix upgrade from 0.03.
-rw-r--r--Upgrade.hs18
-rw-r--r--debian/changelog1
2 files changed, 18 insertions, 1 deletions
diff --git a/Upgrade.hs b/Upgrade.hs
index d64d5287d..52ecfa07d 100644
--- a/Upgrade.hs
+++ b/Upgrade.hs
@@ -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
diff --git a/debian/changelog b/debian/changelog
index 19ff29652..7ac893c13 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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