summaryrefslogtreecommitdiff
path: root/Upgrade
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-03 22:24:57 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-03 23:29:48 -0400
commit8ef2095fa00408ce6729596a42bc0abdc7778098 (patch)
treed6fc3c9f9519ba2ce617a804ce1c5f33f59a9109 /Upgrade
parent003a604a6e48a8a0ffd1564e3399b54e8c673e92 (diff)
factor out common imports
no code changes
Diffstat (limited to 'Upgrade')
-rw-r--r--Upgrade/V0.hs12
-rw-r--r--Upgrade/V1.hs26
-rw-r--r--Upgrade/V2.hs20
3 files changed, 12 insertions, 46 deletions
diff --git a/Upgrade/V0.hs b/Upgrade/V0.hs
index 3aabe0770..f8e6cda56 100644
--- a/Upgrade/V0.hs
+++ b/Upgrade/V0.hs
@@ -8,23 +8,15 @@
module Upgrade.V0 where
import System.IO.Error (try)
-import System.Directory
-import Control.Monad.State (liftIO)
-import Control.Monad (filterM, forM_)
-import System.Posix.Files
-import System.FilePath
+import AnnexCommon
import Content
-import Types
-import Locations
-import qualified Annex
-import Messages
import qualified Upgrade.V1
upgrade :: Annex Bool
upgrade = do
showAction "v0 to v1"
- g <- Annex.gitRepo
+ g <- gitRepo
-- do the reorganisation of the key files
let olddir = gitAnnexDir g
diff --git a/Upgrade/V1.hs b/Upgrade/V1.hs
index 329f90ed6..bc50b857c 100644
--- a/Upgrade/V1.hs
+++ b/Upgrade/V1.hs
@@ -8,33 +8,19 @@
module Upgrade.V1 where
import System.IO.Error (try)
-import System.Directory
-import Control.Monad.State (liftIO)
-import Control.Monad (filterM, forM_, unless)
-import Control.Applicative
-import System.Posix.Files
-import System.FilePath
-import Data.String.Utils
import System.Posix.Types
-import Data.Maybe
import Data.Char
+import AnnexCommon
import Types.Key
import Content
-import Types
-import Locations
import PresenceLog
-import qualified Annex
import qualified AnnexQueue
import qualified Git
import qualified Git.LsFiles as LsFiles
import Backend
-import Messages
import Version
-import Utility
import Utility.FileMode
-import Utility.SafeCommand
-import Utility.Path
import qualified Upgrade.V2
-- v2 adds hashing of filenames of content and location log files.
@@ -64,7 +50,7 @@ upgrade :: Annex Bool
upgrade = do
showAction "v1 to v2"
- g <- Annex.gitRepo
+ g <- gitRepo
if Git.repoIsLocalBare g
then do
moveContent
@@ -96,7 +82,7 @@ moveContent = do
updateSymlinks :: Annex ()
updateSymlinks = do
showAction "updating symlinks"
- g <- Annex.gitRepo
+ g <- gitRepo
files <- liftIO $ LsFiles.inRepo g [Git.workTree g]
forM_ files fixlink
where
@@ -117,7 +103,7 @@ moveLocationLogs = do
forM_ logkeys move
where
oldlocationlogs = do
- g <- Annex.gitRepo
+ g <- gitRepo
let dir = Upgrade.V2.gitStateDir g
exists <- liftIO $ doesDirectoryExist dir
if exists
@@ -126,7 +112,7 @@ moveLocationLogs = do
return $ mapMaybe oldlog2key contents
else return []
move (l, k) = do
- g <- Annex.gitRepo
+ g <- gitRepo
let dest = logFile2 g k
let dir = Upgrade.V2.gitStateDir g
let f = dir </> l
@@ -220,7 +206,7 @@ lookupFile1 file = do
getKeyFilesPresent1 :: Annex [FilePath]
getKeyFilesPresent1 = do
- g <- Annex.gitRepo
+ g <- gitRepo
getKeyFilesPresent1' $ gitAnnexObjectDir g
getKeyFilesPresent1' :: FilePath -> Annex [FilePath]
getKeyFilesPresent1' dir = do
diff --git a/Upgrade/V2.hs b/Upgrade/V2.hs
index 4e686288f..922dfff28 100644
--- a/Upgrade/V2.hs
+++ b/Upgrade/V2.hs
@@ -7,21 +7,9 @@
module Upgrade.V2 where
-import System.Directory
-import System.FilePath
-import Control.Monad.State (unless, when, liftIO)
-import Data.List
-import Data.Maybe
-
-import Types.Key
-import Types
-import qualified Annex
+import AnnexCommon
import qualified Git
import qualified Branch
-import Messages
-import Utility
-import Utility.Conditional
-import Utility.SafeCommand
import LocationLog
import Content
@@ -48,7 +36,7 @@ olddir g
upgrade :: Annex Bool
upgrade = do
showAction "v2 to v3"
- g <- Annex.gitRepo
+ g <- gitRepo
let bare = Git.repoIsLocalBare g
Branch.create
@@ -85,7 +73,7 @@ locationLogs repo = liftIO $ do
inject :: FilePath -> FilePath -> Annex ()
inject source dest = do
- g <- Annex.gitRepo
+ g <- gitRepo
new <- liftIO (readFile $ olddir g </> source)
Branch.change dest $ \prev ->
unlines $ nub $ lines prev ++ lines new
@@ -114,7 +102,7 @@ push = do
Branch.update -- just in case
showAction "pushing new git-annex branch to origin"
showOutput
- g <- Annex.gitRepo
+ g <- gitRepo
liftIO $ Git.run g "push" [Param "origin", Param Branch.name]
_ -> do
-- no origin exists, so just let the user