import Annex.Version
import Types.RepoVersion
#ifndef mingw32_HOST_OS
-{-
import qualified Upgrade.V0
import qualified Upgrade.V1
#endif
import qualified Upgrade.V4
import qualified Upgrade.V5
import qualified Upgrade.V6
--}
import qualified Data.Map as M
)
go _ = return True
-{-
#ifndef mingw32_HOST_OS
up (RepoVersion 0) = Upgrade.V0.upgrade
up (RepoVersion 1) = Upgrade.V1.upgrade
up (RepoVersion 4) = Upgrade.V4.upgrade automatic
up (RepoVersion 5) = Upgrade.V5.upgrade automatic
up (RepoVersion 6) = Upgrade.V6.upgrade automatic
--}
up _ = return True
-
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
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
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]
- Licensed under the GNU AGPL version 3 or higher.
-}
+{-# LANGUAGE OverloadedStrings #-}
+
module Upgrade.V5 where
import Annex.Common
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
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)