diff options
author | Joey Hess <joey@kitenet.net> | 2011-03-29 14:55:59 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2011-03-29 14:55:59 -0400 |
commit | 0a4c610b4fd78f7d1589117cb723d7d8c15c120c (patch) | |
tree | 21682bc0b6314d1f47b539cbecbd80794fed2020 /Remote.hs | |
parent | 05751d55cd8002e6a2a2afc520622fb6697472e3 (diff) |
initremote works
Diffstat (limited to 'Remote.hs')
-rw-r--r-- | Remote.hs | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -15,12 +15,14 @@ module Remote ( hasKey, hasKeyCheap, + remoteTypes, byName, nameToUUID, keyPossibilities, remotesWithUUID, remotesWithoutUUID, + remoteLog, readRemoteLog, configSet, keyValToMap @@ -34,8 +36,6 @@ import qualified Data.Map as M import Data.Maybe import RemoteClass -import qualified Remote.Git -import qualified Remote.S3 import Types import UUID import qualified Annex @@ -43,6 +43,10 @@ import Trust import LocationLog import Locations import Messages +import Utility + +import qualified Remote.Git +import qualified Remote.S3 remoteTypes :: [RemoteType Annex] remoteTypes = @@ -150,7 +154,8 @@ configSet :: UUID -> M.Map String String -> Annex () configSet u c = do m <- readRemoteLog l <- remoteLog - liftIO $ writeFile l $ unlines $ map toline $ M.toList $ M.insert u c m + liftIO $ safeWriteFile l $ unlines $ sort $ + map toline $ M.toList $ M.insert u c m where toline (u', c') = u' ++ " " ++ (unwords $ mapToKeyVal c') @@ -185,6 +190,6 @@ keyValToMap ws = M.fromList $ map (/=/) ws v = drop (1 + length k) s mapToKeyVal :: M.Map String String -> [String] -mapToKeyVal m = map toword $ M.toList m +mapToKeyVal m = map toword $ sort $ M.toList m where toword (k, v) = k ++ "=" ++ v |