summaryrefslogtreecommitdiff
path: root/Remote/List.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-05 14:49:47 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-05 14:49:47 -0400
commitcb0f435d948a597429db5e51f2b3d2b15294090f (patch)
tree3334d153133668abc296b7343899b5cf64ae28f1 /Remote/List.hs
parentccedd06023b0c2f189ff157e29b6295f984c9624 (diff)
adding removable drive repos now basically works
Diffstat (limited to 'Remote/List.hs')
-rw-r--r--Remote/List.hs23
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