refactor
This commit is contained in:
parent
78d3add86b
commit
f4ca592cd0
3 changed files with 8 additions and 4 deletions
|
@ -66,15 +66,14 @@ syncRemotes rs = ifM (Annex.getState Annex.fast) ( nub <$> pickfast , wanted )
|
||||||
| otherwise = listed
|
| otherwise = listed
|
||||||
listed = do
|
listed = do
|
||||||
l <- catMaybes <$> mapM (Remote.byName . Just) rs
|
l <- catMaybes <$> mapM (Remote.byName . Just) rs
|
||||||
let s = filter special l
|
let s = filter Remote.specialRemote l
|
||||||
unless (null s) $
|
unless (null s) $
|
||||||
error $ "cannot sync special remotes: " ++
|
error $ "cannot sync special remotes: " ++
|
||||||
unwords (map Types.Remote.name s)
|
unwords (map Types.Remote.name s)
|
||||||
return l
|
return l
|
||||||
available = filter nonspecial <$> Remote.enabledRemoteList
|
available = filter (not . Remote.specialRemote)
|
||||||
|
<$> Remote.enabledRemoteList
|
||||||
good = filterM $ Remote.Git.repoAvail . Types.Remote.repo
|
good = filterM $ Remote.Git.repoAvail . Types.Remote.repo
|
||||||
nonspecial r = Types.Remote.remotetype r == Remote.Git.remote
|
|
||||||
special = not . nonspecial
|
|
||||||
fastest = fromMaybe [] . headMaybe . byspeed
|
fastest = fromMaybe [] . headMaybe . byspeed
|
||||||
byspeed = map snd . sort . M.toList . costmap
|
byspeed = map snd . sort . M.toList . costmap
|
||||||
costmap = M.fromListWith (++) . map costpair
|
costmap = M.fromListWith (++) . map costpair
|
||||||
|
|
|
@ -20,6 +20,7 @@ module Remote (
|
||||||
remoteTypes,
|
remoteTypes,
|
||||||
remoteList,
|
remoteList,
|
||||||
enabledRemoteList,
|
enabledRemoteList,
|
||||||
|
specialRemote,
|
||||||
remoteMap,
|
remoteMap,
|
||||||
uuidDescriptions,
|
uuidDescriptions,
|
||||||
byName,
|
byName,
|
||||||
|
|
|
@ -90,3 +90,7 @@ updateRemote remote = do
|
||||||
{- All remotes that are not ignored. -}
|
{- All remotes that are not ignored. -}
|
||||||
enabledRemoteList :: Annex [Remote]
|
enabledRemoteList :: Annex [Remote]
|
||||||
enabledRemoteList = filterM (repoNotIgnored . repo) =<< remoteList
|
enabledRemoteList = filterM (repoNotIgnored . repo) =<< remoteList
|
||||||
|
|
||||||
|
{- Checks if a remote is a special remote -}
|
||||||
|
specialRemote :: Remote -> Bool
|
||||||
|
specialRemote r = remotetype r /= Remote.Git.remote
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue