aboutsummaryrefslogtreecommitdiff
path: root/Remote.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-04-09 14:10:29 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-04-09 14:14:55 -0400
commit8de1359bbbb3a5bd8a4a5588bacef88eb234bb7b (patch)
tree1ae689b9883bef374a6328229c693b3e9e636eca /Remote.hs
parent8014dafedf59f7feaac4153af5e330ab84a9cf8b (diff)
make git-remote-daemon ssh transport robust
* Remote system might be available, and connection get lost. Should reconnect, but needs to avoid bad behavior (ie, constant reconnect attempts.) Use exponential backoff. * Detect if old system had a too old git-annex-shell, and show the user a nice message in the webapp. Required parsing error messages, so perhaps this code shoudl be removed once enough time has passed.. * Switch the protocol to using remote URI's, rather than remote names. Names change. Also avoids issues with serialization of names containing whitespace. This is nearly ready for merge into master now. I'd still like to make the ssh transport smarter about reusing ssh connection caching during git pull. This commit was sponsored by Jim Paris.
Diffstat (limited to 'Remote.hs')
-rw-r--r--Remote.hs17
1 files changed, 14 insertions, 3 deletions
diff --git a/Remote.hs b/Remote.hs
index 0f31b99b2..da33e195e 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -22,6 +22,7 @@ module Remote (
remoteList,
gitSyncableRemote,
remoteMap,
+ remoteMap',
uuidDescriptions,
byName,
byNameOnly,
@@ -64,9 +65,19 @@ import Git.Types (RemoteName)
import qualified Git
{- Map from UUIDs of Remotes to a calculated value. -}
-remoteMap :: (Remote -> a) -> Annex (M.Map UUID a)
-remoteMap c = M.fromList . map (\r -> (uuid r, c r)) .
- filter (\r -> uuid r /= NoUUID) <$> remoteList
+remoteMap :: (Remote -> v) -> Annex (M.Map UUID v)
+remoteMap mkv = remoteMap' mkv mkk
+ where
+ mkk r = case uuid r of
+ NoUUID -> Nothing
+ u -> Just u
+
+remoteMap' :: Ord k => (Remote -> v) -> (Remote -> Maybe k) -> Annex (M.Map k v)
+remoteMap' mkv mkk = M.fromList . mapMaybe mk <$> remoteList
+ where
+ mk r = case mkk r of
+ Nothing -> Nothing
+ Just k -> Just (k, mkv r)
{- Map of UUIDs of remotes and their descriptions.
- The names of Remotes are added to suppliment any description that has