include upgrade code back in
authorJoey Hess <joeyh@joeyh.name>
Mon, 2 Dec 2019 16:01:20 +0000 (12:01 -0400)
committerJoey Hess <joeyh@joeyh.name>
Mon, 2 Dec 2019 16:16:46 +0000 (12:16 -0400)
Remaining things that need to be fixed up to get this branch into a
basically mergeable state: remotes, commands, and the assistant

Upgrade.hs
Upgrade/V1.hs
Upgrade/V2.hs
Upgrade/V5.hs

index fed76d838e852e3d4316c2d9356e4e90b8668018..457fab180b10571c95d2d2319902103f24711138 100644 (file)
@@ -15,7 +15,6 @@ import qualified Git
 import Annex.Version
 import Types.RepoVersion
 #ifndef mingw32_HOST_OS
-{-
 import qualified Upgrade.V0
 import qualified Upgrade.V1
 #endif
@@ -24,7 +23,6 @@ import qualified Upgrade.V3
 import qualified Upgrade.V4
 import qualified Upgrade.V5
 import qualified Upgrade.V6
--}
 
 import qualified Data.Map as M
 
@@ -74,7 +72,6 @@ upgrade automatic destversion = do
                        )
        go _ = return True
 
-{-
 #ifndef mingw32_HOST_OS
        up (RepoVersion 0) = Upgrade.V0.upgrade
        up (RepoVersion 1) = Upgrade.V1.upgrade
@@ -87,6 +84,4 @@ upgrade automatic destversion = do
        up (RepoVersion 4) = Upgrade.V4.upgrade automatic
        up (RepoVersion 5) = Upgrade.V5.upgrade automatic
        up (RepoVersion 6) = Upgrade.V6.upgrade automatic
--}
        up _ = return True
-
index 0d41dde2a5e55c166daf6a0a7ad668c8812f6a89..fd46108dd55dba8d698941e378781ff97b1d24a7 100644 (file)
@@ -84,8 +84,8 @@ updateSymlinks :: Annex ()
 updateSymlinks = do
        showAction "updating symlinks"
        top <- fromRepo Git.repoPath
-       (files, cleanup) <- inRepo $ LsFiles.inRepo [top]
-       forM_ files fixlink
+       (files, cleanup) <- inRepo $ LsFiles.inRepo [toRawFilePath top]
+       forM_ files (fixlink . fromRawFilePath)
        void $ liftIO cleanup
   where
        fixlink f = do
index ffac8e49aa0eb2b42aebf3ac46be3a44aebbbcf1..9b29783e9d3dce8d9df041d876a81620126cb684 100644 (file)
@@ -50,7 +50,7 @@ upgrade = do
        e <- liftIO $ doesDirectoryExist old
        when e $ do
                config <- Annex.getGitConfig
-               mapM_ (\(k, f) -> inject f $ locationLogFile config k) =<< locationLogs
+               mapM_ (\(k, f) -> inject f $ fromRawFilePath $ locationLogFile config k) =<< locationLogs
                mapM_ (\f -> inject f f) =<< logFiles old
 
        saveState False
@@ -76,13 +76,13 @@ locationLogs = do
   where
        tryDirContents d = catchDefaultIO [] $ dirContents d
        islogfile f = maybe Nothing (\k -> Just (k, f)) $
-                       locationLogFileKey f
+                       locationLogFileKey (toRawFilePath f)
 
 inject :: FilePath -> FilePath -> Annex ()
 inject source dest = do
        old <- fromRepo olddir
        new <- liftIO (readFile $ old </> source)
-       Annex.Branch.change dest $ \prev -> 
+       Annex.Branch.change (toRawFilePath dest) $ \prev -> 
                encodeBL $ unlines $ nub $ lines (decodeBL prev) ++ lines new
 
 logFiles :: FilePath -> Annex [FilePath]
index 5d331c87871df96c922d277aa93064d7c19e02eb..ba897399f2d2b27ac0163f3fe443f79aea5596d0 100644 (file)
@@ -5,6 +5,8 @@
  - Licensed under the GNU AGPL version 3 or higher.
  -}
 
+{-# LANGUAGE OverloadedStrings #-}
+
 module Upgrade.V5 where
 
 import Annex.Common
@@ -106,7 +108,7 @@ convertDirect = do
 upgradeDirectWorkTree :: Annex ()
 upgradeDirectWorkTree = do
        top <- fromRepo Git.repoPath
-       (l, clean) <- inRepo $ Git.LsFiles.stagedDetails [top]
+       (l, clean) <- inRepo $ Git.LsFiles.stagedDetails [toRawFilePath top]
        forM_ l go
        void $ liftIO clean
   where
@@ -119,11 +121,11 @@ upgradeDirectWorkTree = do
                        Just k -> do
                                stagePointerFile f Nothing =<< hashPointerFile k
                                ifM (isJust <$> getAnnexLinkTarget f)
-                                       ( writepointer f k
-                                       , fromdirect f k
+                                       ( writepointer (fromRawFilePath f) k
+                                       , fromdirect (fromRawFilePath f) k
                                        )
                                Database.Keys.addAssociatedFile k
-                                       =<< inRepo (toTopFilePath f)
+                                       =<< inRepo (toTopFilePath (fromRawFilePath f))
        go _ = noop
 
        fromdirect f k = ifM (Direct.goodContent k f)