diff options
author | Joey Hess <joey@kitenet.net> | 2012-08-05 14:49:47 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-08-05 14:49:47 -0400 |
commit | cb0f435d948a597429db5e51f2b3d2b15294090f (patch) | |
tree | 3334d153133668abc296b7343899b5cf64ae28f1 /Remote | |
parent | ccedd06023b0c2f189ff157e29b6295f984c9624 (diff) |
adding removable drive repos now basically works
Diffstat (limited to 'Remote')
-rw-r--r-- | Remote/List.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Remote/List.hs b/Remote/List.hs index 4127cf24b..3f3792744 100644 --- a/Remote/List.hs +++ b/Remote/List.hs @@ -19,6 +19,7 @@ import Annex.UUID import Config import Remote.Helper.Hooks import qualified Git +import qualified Git.Config import qualified Remote.Git #ifdef WITH_S3 @@ -58,12 +59,34 @@ remoteList = do where process m t = enumerate t >>= mapM (remoteGen m t) +{- Forces the remoteList to be re-generated, re-reading the git config. -} +remoteListRefresh :: Annex [Remote] +remoteListRefresh = do + newg <- inRepo Git.Config.reRead + Annex.changeState $ \s -> s + { Annex.remotes = [] + , Annex.repo = newg + } + remoteList + {- Generates a Remote. -} remoteGen :: (M.Map UUID RemoteConfig) -> RemoteType -> Git.Repo -> Annex Remote remoteGen m t r = do u <- getRepoUUID r addHooks =<< generate t r u (M.lookup u m) +{- Updates a local git Remote, re-reading its git config. -} +updateRemote :: Remote -> Annex Remote +updateRemote remote = do + m <- readRemoteLog + remote' <- updaterepo $ repo remote + remoteGen m (remotetype remote) remote' + where + updaterepo r + | Git.repoIsLocal r || Git.repoIsLocalUnknown r = + Remote.Git.configRead r + | otherwise = return r + {- All remotes that are not ignored. -} enabledRemoteList :: Annex [Remote] enabledRemoteList = filterM (repoNotIgnored . repo) =<< remoteList |