diff options
author | Joey Hess <joey@kitenet.net> | 2011-10-03 22:24:57 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-10-03 23:29:48 -0400 |
commit | 8ef2095fa00408ce6729596a42bc0abdc7778098 (patch) | |
tree | d6fc3c9f9519ba2ce617a804ce1c5f33f59a9109 /Content.hs | |
parent | 003a604a6e48a8a0ffd1564e3399b54e8c673e92 (diff) |
factor out common imports
no code changes
Diffstat (limited to 'Content.hs')
-rw-r--r-- | Content.hs | 34 |
1 files changed, 11 insertions, 23 deletions
diff --git a/Content.hs b/Content.hs index f963c48b4..567e4caa5 100644 --- a/Content.hs +++ b/Content.hs @@ -21,26 +21,14 @@ module Content ( saveState ) where -import System.Directory -import Control.Monad.State (liftIO) -import System.Path -import Control.Monad -import System.Posix.Files -import System.FilePath -import Data.Maybe - -import Types -import Locations +import AnnexCommon import LocationLog import UUID import qualified Git import qualified Annex import qualified AnnexQueue import qualified Branch -import Utility -import Utility.Conditional import Utility.StatFS -import Utility.Path import Utility.FileMode import Types.Key import Utility.DataUnits @@ -49,14 +37,14 @@ import Config {- Checks if a given key is currently present in the gitAnnexLocation. -} inAnnex :: Key -> Annex Bool inAnnex key = do - g <- Annex.gitRepo + g <- gitRepo when (Git.repoIsUrl g) $ error "inAnnex cannot check remote repo" liftIO $ doesFileExist $ gitAnnexLocation g key {- Calculates the relative path to use to link a file to a key. -} calcGitLink :: FilePath -> Key -> Annex FilePath calcGitLink file key = do - g <- Annex.gitRepo + g <- gitRepo cwd <- liftIO getCurrentDirectory let absfile = fromMaybe whoops $ absNormPath cwd file return $ relPathDirToFile (parentDir absfile) @@ -68,7 +56,7 @@ calcGitLink file key = do - repository. -} logStatus :: Key -> LogStatus -> Annex () logStatus key status = do - g <- Annex.gitRepo + g <- gitRepo u <- getUUID g logChange g key u status @@ -77,7 +65,7 @@ logStatus key status = do - the annex as a key's content. -} getViaTmp :: Key -> (FilePath -> Annex Bool) -> Annex Bool getViaTmp key action = do - g <- Annex.gitRepo + g <- gitRepo let tmp = gitAnnexTmpLocation g key -- Check that there is enough free disk space. @@ -96,7 +84,7 @@ getViaTmp key action = do prepTmp :: Key -> Annex FilePath prepTmp key = do - g <- Annex.gitRepo + g <- gitRepo let tmp = gitAnnexTmpLocation g key liftIO $ createDirectoryIfMissing True (parentDir tmp) return tmp @@ -133,7 +121,7 @@ checkDiskSpace = checkDiskSpace' 0 checkDiskSpace' :: Integer -> Key -> Annex () checkDiskSpace' adjustment key = do - g <- Annex.gitRepo + g <- gitRepo r <- getConfig g "diskreserve" "" let reserve = fromMaybe megabyte $ readSize dataUnits r stats <- liftIO $ getFileSystemStats (gitAnnexDir g) @@ -174,7 +162,7 @@ checkDiskSpace' adjustment key = do -} moveAnnex :: Key -> FilePath -> Annex () moveAnnex key src = do - g <- Annex.gitRepo + g <- gitRepo let dest = gitAnnexLocation g key let dir = parentDir dest e <- liftIO $ doesFileExist dest @@ -189,7 +177,7 @@ moveAnnex key src = do withObjectLoc :: Key -> ((FilePath, FilePath) -> Annex a) -> Annex a withObjectLoc key a = do - g <- Annex.gitRepo + g <- gitRepo let file = gitAnnexLocation g key let dir = parentDir file a (dir, file) @@ -213,7 +201,7 @@ fromAnnex key dest = withObjectLoc key $ \(dir, file) -> liftIO $ do - returns the file it was moved to. -} moveBad :: Key -> Annex FilePath moveBad key = do - g <- Annex.gitRepo + g <- gitRepo let src = gitAnnexLocation g key let dest = gitAnnexBadDir g </> takeFileName src liftIO $ do @@ -227,7 +215,7 @@ moveBad key = do {- List of keys whose content exists in .git/annex/objects/ -} getKeysPresent :: Annex [Key] getKeysPresent = do - g <- Annex.gitRepo + g <- gitRepo getKeysPresent' $ gitAnnexObjectDir g getKeysPresent' :: FilePath -> Annex [Key] getKeysPresent' dir = do |