diff options
author | Joey Hess <joey@kitenet.net> | 2010-10-19 14:13:48 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-10-19 14:13:48 -0400 |
commit | 4f8d28819da8e13bfa741dae8d84b0000e38e083 (patch) | |
tree | c06dfeba3aff78769eee35dbc8f3cd7060d3effa /Remotes.hs | |
parent | ed3f6653b664d72e4b89c4dd0c56f4b7db7cbab9 (diff) |
improved messages when a file is not available in remotes
Diffstat (limited to 'Remotes.hs')
-rw-r--r-- | Remotes.hs | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/Remotes.hs b/Remotes.hs index 828dc753f..a0894f418 100644 --- a/Remotes.hs +++ b/Remotes.hs @@ -10,6 +10,7 @@ import Control.Exception import Control.Monad.State (liftIO) import qualified Data.Map as Map import Data.String.Utils +import Data.Either.Utils import List import Maybe @@ -42,8 +43,8 @@ withKey key = do where tryharder allremotes uuids = do -- more expensive; read each remote's config - mayberemotes <- mapM tryGitConfigRead allremotes - let allremotes' = catMaybes mayberemotes + eitherremotes <- mapM tryGitConfigRead allremotes + let allremotes' = map fromEither eitherremotes remotes' <- reposByUUID allremotes' uuids Annex.flagChange RemotesRead True return remotes' @@ -86,7 +87,7 @@ repoCost r = do - because reading it may be expensive. This function tries to read the - config for a specified remote, and updates state. If successful, it - returns the updated git repo. -} -tryGitConfigRead :: Git.Repo -> Annex (Maybe Git.Repo) +tryGitConfigRead :: Git.Repo -> Annex (Either Git.Repo Git.Repo) tryGitConfigRead r = do if (Map.null $ Git.configMap r) then do @@ -94,15 +95,15 @@ tryGitConfigRead r = do -- for other reasons; catch all possible exceptions result <- liftIO $ (try (Git.configRead r)::IO (Either SomeException (Git.Repo))) case (result) of - Left err -> return Nothing + Left err -> return $ Left r Right r' -> do g <- Annex.gitRepo let l = Git.remotes g let g' = Git.remotesAdd g $ exchange l r' Annex.gitRepoChange g' - return $ Just r' - else return $ Just r + return $ Right r' + else return $ Right r -- config already read where exchange [] new = [] exchange (old:ls) new = |