summaryrefslogtreecommitdiff
path: root/Command/Sync.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-05-27 20:55:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-05-27 20:55:56 -0400
commit6e213d04f1233af3faffcd49acf479be086c71f4 (patch)
tree00adec37e6a8654d9d95540a3d1788df5184fecf /Command/Sync.hs
parentf120dbc73587bbff42910dce9eb26b79cebe424f (diff)
sync: Show a nicer message if a user tries to sync to a special remote.
Diffstat (limited to 'Command/Sync.hs')
-rw-r--r--Command/Sync.hs9
1 files changed, 8 insertions, 1 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index b9ef0bc97..5fb49d30c 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -57,10 +57,17 @@ syncRemotes rs = ifM (Annex.getState Annex.fast) ( nub <$> pickfast , wanted )
wanted
| null rs = good =<< concat . byspeed <$> available
| otherwise = listed
- listed = catMaybes <$> mapM (Remote.byName . Just) rs
+ listed = do
+ l <- catMaybes <$> mapM (Remote.byName . Just) rs
+ let s = filter special l
+ unless (null s) $
+ error $ "cannot sync special remotes: " ++
+ unwords (map Types.Remote.name s)
+ return l
available = filter nonspecial <$> 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