summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-08-26 14:34:30 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-08-26 14:34:30 -0400
commitf4ca592cd0ac4940645f2f17fadac5e0da45424d (patch)
treeda00855b29ceeddbb776c7fb28f2b0894d0fee2e
parent78d3add86b564149cd1e7c4527deffbf30cf839b (diff)
refactor
-rw-r--r--Command/Sync.hs7
-rw-r--r--Remote.hs1
-rw-r--r--Remote/List.hs4
3 files changed, 8 insertions, 4 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index 023b1b84a..986dd417b 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -66,15 +66,14 @@ syncRemotes rs = ifM (Annex.getState Annex.fast) ( nub <$> pickfast , wanted )
| otherwise = listed
listed = do
l <- catMaybes <$> mapM (Remote.byName . Just) rs
- let s = filter special l
+ let s = filter Remote.specialRemote l
unless (null s) $
error $ "cannot sync special remotes: " ++
unwords (map Types.Remote.name s)
return l
- available = filter nonspecial <$> Remote.enabledRemoteList
+ available = filter (not . Remote.specialRemote)
+ <$> Remote.enabledRemoteList
good = filterM $ Remote.Git.repoAvail . Types.Remote.repo
- nonspecial r = Types.Remote.remotetype r == Remote.Git.remote
- special = not . nonspecial
fastest = fromMaybe [] . headMaybe . byspeed
byspeed = map snd . sort . M.toList . costmap
costmap = M.fromListWith (++) . map costpair
diff --git a/Remote.hs b/Remote.hs
index ac9da0536..ae5a231ad 100644
--- a/Remote.hs
+++ b/Remote.hs
@@ -20,6 +20,7 @@ module Remote (
remoteTypes,
remoteList,
enabledRemoteList,
+ specialRemote,
remoteMap,
uuidDescriptions,
byName,
diff --git a/Remote/List.hs b/Remote/List.hs
index 3f3792744..234f310a5 100644
--- a/Remote/List.hs
+++ b/Remote/List.hs
@@ -90,3 +90,7 @@ updateRemote remote = do
{- All remotes that are not ignored. -}
enabledRemoteList :: Annex [Remote]
enabledRemoteList = filterM (repoNotIgnored . repo) =<< remoteList
+
+{- Checks if a remote is a special remote -}
+specialRemote :: Remote -> Bool
+specialRemote r = remotetype r /= Remote.Git.remote