summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-12-31 03:27:37 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-12-31 03:27:37 -0400
commit8a33573caff38b557fdf60c9547a78a5cc8c4ddc (patch)
treefed26c043272c62738a9e83357283535195c0397
parent6cd4c7efcdea9a8897aa6b9e2b30e7e3426574bc (diff)
better filtering out of special remotes
-rw-r--r--Command/Sync.hs7
-rw-r--r--Remote/Bup.hs3
-rw-r--r--Remote/Directory.hs3
-rw-r--r--Remote/Git.hs3
-rw-r--r--Remote/Hook.hs3
-rw-r--r--Remote/Rsync.hs3
-rw-r--r--Remote/S3real.hs3
-rw-r--r--Remote/Web.hs3
-rw-r--r--Types/Remote.hs7
9 files changed, 23 insertions, 12 deletions
diff --git a/Command/Sync.hs b/Command/Sync.hs
index f3a83517c..6e78543ef 100644
--- a/Command/Sync.hs
+++ b/Command/Sync.hs
@@ -17,10 +17,10 @@ import qualified Annex
import qualified Annex.Branch
import qualified Git.Command
import qualified Git.Branch
-import qualified Git.Config
import qualified Git.Ref
import qualified Git
import qualified Types.Remote
+import qualified Remote.Git
import qualified Data.ByteString.Lazy.Char8 as L
import qualified Data.Map as M
@@ -61,9 +61,8 @@ syncRemotes rs = do
| null rs = available
| otherwise = listed
listed = mapM Remote.byName rs
- available = filterM hasurl =<< Remote.enabledRemoteList
- hasurl r = not . null <$> geturl r
- geturl r = fromRepo $ Git.Config.get ("remote." ++ Remote.name r ++ ".url") ""
+ available = filter nonspecial <$> Remote.enabledRemoteList
+ nonspecial r = Types.Remote.remotetype r == Remote.Git.remote
fastest = fromMaybe [] . headMaybe .
map snd . sort . M.toList . costmap
costmap = M.fromListWith (++) . map costpair
diff --git a/Remote/Bup.hs b/Remote/Bup.hs
index cbd5d584a..9311d18e5 100644
--- a/Remote/Bup.hs
+++ b/Remote/Bup.hs
@@ -54,7 +54,8 @@ gen r u c = do
hasKey = checkPresent r bupr',
hasKeyCheap = bupLocal buprepo,
config = c,
- repo = r
+ repo = r,
+ remotetype = remote
}
bupSetup :: UUID -> RemoteConfig -> Annex RemoteConfig
diff --git a/Remote/Directory.hs b/Remote/Directory.hs
index 7f78b2f49..e1b17c241 100644
--- a/Remote/Directory.hs
+++ b/Remote/Directory.hs
@@ -45,7 +45,8 @@ gen r u c = do
hasKey = checkPresent dir,
hasKeyCheap = True,
config = Nothing,
- repo = r
+ repo = r,
+ remotetype = remote
}
directorySetup :: UUID -> RemoteConfig -> Annex RemoteConfig
diff --git a/Remote/Git.hs b/Remote/Git.hs
index e527fa4fe..2f2be5bee 100644
--- a/Remote/Git.hs
+++ b/Remote/Git.hs
@@ -79,7 +79,8 @@ gen r u _ = do
hasKey = inAnnex r',
hasKeyCheap = cheap,
config = Nothing,
- repo = r'
+ repo = r',
+ remotetype = remote
}
{- Tries to read the config for a specified remote, updates state, and
diff --git a/Remote/Hook.hs b/Remote/Hook.hs
index 5c761f43b..08be1a0ee 100644
--- a/Remote/Hook.hs
+++ b/Remote/Hook.hs
@@ -45,7 +45,8 @@ gen r u c = do
hasKey = checkPresent r hooktype,
hasKeyCheap = False,
config = Nothing,
- repo = r
+ repo = r,
+ remotetype = remote
}
hookSetup :: UUID -> RemoteConfig -> Annex RemoteConfig
diff --git a/Remote/Rsync.hs b/Remote/Rsync.hs
index 68566c52a..91a72e88e 100644
--- a/Remote/Rsync.hs
+++ b/Remote/Rsync.hs
@@ -52,7 +52,8 @@ gen r u c = do
hasKey = checkPresent r o,
hasKeyCheap = False,
config = Nothing,
- repo = r
+ repo = r,
+ remotetype = remote
}
genRsyncOpts :: Git.Repo -> Annex RsyncOpts
diff --git a/Remote/S3real.hs b/Remote/S3real.hs
index b79939b90..23a589726 100644
--- a/Remote/S3real.hs
+++ b/Remote/S3real.hs
@@ -57,7 +57,8 @@ gen' r u c cst =
hasKey = checkPresent this,
hasKeyCheap = False,
config = c,
- repo = r
+ repo = r,
+ remotetype = remote
}
s3Setup :: UUID -> RemoteConfig -> Annex RemoteConfig
diff --git a/Remote/Web.hs b/Remote/Web.hs
index e31539f88..c0d54132a 100644
--- a/Remote/Web.hs
+++ b/Remote/Web.hs
@@ -43,7 +43,8 @@ gen r _ _ =
hasKey = checkKey,
hasKeyCheap = False,
config = Nothing,
- repo = r
+ repo = r,
+ remotetype = remote
}
downloadKey :: Key -> FilePath -> Annex Bool
diff --git a/Types/Remote.hs b/Types/Remote.hs
index ec9b7a7a7..3a8a23f31 100644
--- a/Types/Remote.hs
+++ b/Types/Remote.hs
@@ -30,6 +30,9 @@ data RemoteType a = RemoteType {
setup :: UUID -> RemoteConfig -> a RemoteConfig
}
+instance Eq (RemoteType a) where
+ x == y = typename x == typename y
+
{- An individual remote. -}
data Remote a = Remote {
-- each Remote has a unique uuid
@@ -53,7 +56,9 @@ data Remote a = Remote {
-- a Remote can have a persistent configuration store
config :: Maybe RemoteConfig,
-- git configuration for the remote
- repo :: Git.Repo
+ repo :: Git.Repo,
+ -- the type of the remote
+ remotetype :: RemoteType a
}
instance Show (Remote a) where