more namespace cleanup

This commit is contained in:
Joey Hess 2010-10-14 02:41:54 -04:00
parent 48643b68b3
commit 4c1d8b9689
3 changed files with 18 additions and 18 deletions

View file

@ -20,7 +20,7 @@ import List
import qualified GitRepo as Git
import Utility
import Locations
import Backend
import qualified Backend
import BackendList
import UUID
import LocationLog
@ -46,7 +46,7 @@ start = do
prepUUID
inBackend file yes no = do
r <- liftIO $ lookupFile file
r <- liftIO $ Backend.lookupFile file
case (r) of
Just v -> yes v
Nothing -> no
@ -57,7 +57,7 @@ notinBackend file yes no = inBackend file no yes
annexCmd :: FilePath -> Annex ()
annexCmd file = inBackend file err $ do
liftIO $ checkLegal file
stored <- storeFile file
stored <- Backend.storeFile file
g <- gitAnnex
case (stored) of
Nothing -> error $ "no backend could store: " ++ file
@ -93,7 +93,7 @@ annexCmd file = inBackend file err $ do
{- Inverse of annexCmd. -}
unannexCmd :: FilePath -> Annex ()
unannexCmd file = notinBackend file err $ \(key, backend) -> do
dropFile backend key
Backend.dropFile backend key
logStatus key ValueMissing
g <- gitAnnex
let src = annexLocation g backend key
@ -121,7 +121,7 @@ getCmd file = notinBackend file err $ \(key, backend) -> do
g <- gitAnnex
let dest = annexLocation g backend key
liftIO $ createDirectoryIfMissing True (parentDir dest)
success <- retrieveFile backend key dest
success <- Backend.retrieveFile backend key dest
if (success)
then do
logStatus key ValuePresent

View file

@ -10,7 +10,7 @@ import Control.Exception
import Types
import LocationLog
import Locations
import Remotes
import qualified Remotes
import qualified GitRepo as Git
backend = Backend {
@ -39,17 +39,17 @@ dummyRemove url = return False
- and copy it over to this one. -}
copyKeyFile :: Key -> FilePath -> Annex (Bool)
copyKeyFile key file = do
remotes <- remotesWithKey key
remotes <- Remotes.withKey key
trycopy remotes remotes
where
trycopy full [] = error $ "unable to get: " ++ (keyFile key) ++ "\n" ++
"To get that file, need access to one of these remotes: " ++
(remotesList full)
(Remotes.list full)
trycopy full (r:rs) = do
-- annexLocation needs the git config to have been
-- read for a remote, so do that now,
-- if it hasn't been already
r' <- remoteEnsureGitConfigRead r
r' <- Remotes.ensureGitConfigRead r
result <- liftIO $ (try (copyFromRemote r' key file)::IO (Either SomeException ()))
case (result) of
Left err -> do

View file

@ -1,9 +1,9 @@
{- git-annex remote repositories -}
module Remotes (
remotesList,
remotesWithKey,
remoteEnsureGitConfigRead
list,
withKey,
ensureGitConfigRead
) where
import Control.Monad.State (liftIO)
@ -17,12 +17,12 @@ import UUID
import List
{- Human visible list of remotes. -}
remotesList :: [Git.Repo] -> String
remotesList remotes = join " " $ map Git.repoDescribe remotes
list :: [Git.Repo] -> String
list remotes = join " " $ map Git.repoDescribe remotes
{- Cost ordered list of remotes that the LocationLog indicate may have a key. -}
remotesWithKey :: Key -> Annex [Git.Repo]
remotesWithKey key = do
withKey :: Key -> Annex [Git.Repo]
withKey key = do
g <- gitAnnex
uuids <- liftIO $ keyLocations g key
allremotes <- remotesByCost
@ -71,8 +71,8 @@ repoCost r = do
- because reading it may be expensive. This function ensures that it is
- read for a specified remote, and updates state. It returns the
- updated git repo also. -}
remoteEnsureGitConfigRead :: Git.Repo -> Annex Git.Repo
remoteEnsureGitConfigRead r = do
ensureGitConfigRead :: Git.Repo -> Annex Git.Repo
ensureGitConfigRead r = do
if (Map.null $ Git.configMap r)
then do
r' <- liftIO $ Git.configRead r