summaryrefslogtreecommitdiff
path: root/Remote.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-06-22 17:08:51 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-06-22 17:08:51 -0400
commit4c4ebf2d7570030a70fdbd313b8b60e9fa727eee (patch)
tree06c632c16399245182f38f3d42b5c46d1d7a71c7 /Remote.hs
parent235e2e63a13c629dcca1aa1638f5f47a8d3983ba (diff)
store trust.log and remote.log in the git-annex branch
.. and I think that's everything that will use the branch
Diffstat (limited to 'Remote.hs')
-rw-r--r--Remote.hs20
1 files changed, 5 insertions, 15 deletions
diff --git a/Remote.hs b/Remote.hs
index 804c0ef5a..512242342 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -33,19 +33,17 @@ module Remote (
prop_idempotent_configEscape
) where
-import Control.Monad.State (liftIO)
import Control.Monad (filterM)
import Data.List
import qualified Data.Map as M
import Data.Maybe
import Data.Char
+import qualified Branch
import Types
import Types.Remote
import UUID
import qualified Annex
-import Locations
-import Utility
import Config
import Trust
import LocationLog
@@ -160,29 +158,21 @@ forceTrust level remotename = do
s { Annex.forcetrust = (r, level):Annex.forcetrust s }
{- Filename of remote.log. -}
-remoteLog :: Annex FilePath
-remoteLog = do
- g <- Annex.gitRepo
- return $ gitStateDir g ++ "remote.log"
+remoteLog :: FilePath
+remoteLog = "remote.log"
{- Adds or updates a remote's config in the log. -}
configSet :: UUID -> RemoteConfig -> Annex ()
configSet u c = do
m <- readRemoteLog
- l <- remoteLog
- liftIO $ safeWriteFile l $ unlines $ sort $
+ Branch.change remoteLog $ unlines $ sort $
map toline $ M.toList $ M.insert u c m
where
toline (u', c') = u' ++ " " ++ (unwords $ configToKeyVal c')
{- Map of remotes by uuid containing key/value config maps. -}
readRemoteLog :: Annex (M.Map UUID RemoteConfig)
-readRemoteLog = do
- l <- remoteLog
- s <- liftIO $ catch (readFile l) ignoreerror
- return $ remoteLogParse s
- where
- ignoreerror _ = return ""
+readRemoteLog = return . remoteLogParse =<< Branch.get remoteLog
remoteLogParse :: String -> M.Map UUID RemoteConfig
remoteLogParse s =