better filtering out of special remotes
This commit is contained in:
parent
6cd4c7efcd
commit
8a33573caf
9 changed files with 23 additions and 12 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -43,7 +43,8 @@ gen r _ _ =
|
|||
hasKey = checkKey,
|
||||
hasKeyCheap = False,
|
||||
config = Nothing,
|
||||
repo = r
|
||||
repo = r,
|
||||
remotetype = remote
|
||||
}
|
||||
|
||||
downloadKey :: Key -> FilePath -> Annex Bool
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue