use new getConfig
This commit is contained in:
parent
4eb5112681
commit
f1398b5583
8 changed files with 16 additions and 21 deletions
|
@ -33,7 +33,6 @@ import Common.Annex
|
|||
import Logs.Location
|
||||
import Annex.UUID
|
||||
import qualified Git
|
||||
import qualified Git.Config
|
||||
import qualified Annex
|
||||
import qualified Annex.Queue
|
||||
import qualified Annex.Branch
|
||||
|
@ -308,7 +307,7 @@ saveState oneshot = do
|
|||
( Annex.Branch.commit "update" , Annex.Branch.stage)
|
||||
where
|
||||
alwayscommit = fromMaybe True . Git.configTrue
|
||||
<$> fromRepo (Git.Config.get "annex.alwayscommit" "")
|
||||
<$> getConfig "annex.alwayscommit" ""
|
||||
|
||||
{- Downloads content from any of a list of urls. -}
|
||||
downloadUrl :: [Url.URLString] -> FilePath -> Annex Bool
|
||||
|
|
|
@ -14,7 +14,7 @@ module Annex.Queue (
|
|||
import Common.Annex
|
||||
import Annex hiding (new)
|
||||
import qualified Git.Queue
|
||||
import qualified Git.Config
|
||||
import Config
|
||||
|
||||
{- Adds a git command to the queue. -}
|
||||
add :: String -> [CommandParam] -> [FilePath] -> Annex ()
|
||||
|
@ -43,11 +43,11 @@ get = maybe new return =<< getState repoqueue
|
|||
|
||||
new :: Annex Git.Queue.Queue
|
||||
new = do
|
||||
q <- Git.Queue.new <$> fromRepo queuesize
|
||||
q <- Git.Queue.new <$> queuesize
|
||||
store q
|
||||
return q
|
||||
where
|
||||
queuesize r = readish =<< Git.Config.getMaybe "annex.queuesize" r
|
||||
queuesize = readish <$> getConfig "annex.queuesize" ""
|
||||
|
||||
store :: Git.Queue.Queue -> Annex ()
|
||||
store q = changeState $ \s -> s { repoqueue = Just q }
|
||||
|
|
|
@ -15,7 +15,7 @@ import qualified Data.Map as M
|
|||
import Common.Annex
|
||||
import Annex.LockPool
|
||||
import qualified Git
|
||||
import qualified Git.Config
|
||||
import Config
|
||||
import qualified Build.SysConfig as SysConfig
|
||||
|
||||
{- Generates parameters to ssh to a given host (or user@host) on a given
|
||||
|
@ -47,7 +47,7 @@ sshInfo (host, port) = ifM caching
|
|||
where
|
||||
caching = fromMaybe SysConfig.sshconnectioncaching
|
||||
. Git.configTrue
|
||||
<$> fromRepo (Git.Config.get "annex.sshcaching" "")
|
||||
<$> getConfig "annex.sshcaching" ""
|
||||
|
||||
cacheParams :: FilePath -> [CommandParam]
|
||||
cacheParams socketfile =
|
||||
|
|
|
@ -47,7 +47,7 @@ getUUID = getRepoUUID =<< gitRepo
|
|||
{- Looks up a repo's UUID, caching it in .git/config if it's not already. -}
|
||||
getRepoUUID :: Git.Repo -> Annex UUID
|
||||
getRepoUUID r = do
|
||||
c <- fromRepo cached
|
||||
c <- toUUID <$> getConfig cachekey ""
|
||||
let u = getUncachedUUID r
|
||||
|
||||
if c /= u && u /= NoUUID
|
||||
|
@ -56,7 +56,6 @@ getRepoUUID r = do
|
|||
return u
|
||||
else return c
|
||||
where
|
||||
cached = toUUID . Git.Config.get cachekey ""
|
||||
updatecache u = do
|
||||
g <- gitRepo
|
||||
when (g /= r) $ storeUUID cachekey u
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
module Annex.Version where
|
||||
|
||||
import Common.Annex
|
||||
import qualified Git.Config
|
||||
import Config
|
||||
|
||||
type Version = String
|
||||
|
@ -26,7 +25,7 @@ versionField :: String
|
|||
versionField = "annex.version"
|
||||
|
||||
getVersion :: Annex (Maybe Version)
|
||||
getVersion = handle <$> fromRepo (Git.Config.get versionField "")
|
||||
getVersion = handle <$> getConfig versionField ""
|
||||
where
|
||||
handle [] = Nothing
|
||||
handle v = Just v
|
||||
|
|
|
@ -18,7 +18,7 @@ module Backend (
|
|||
import System.Posix.Files
|
||||
|
||||
import Common.Annex
|
||||
import qualified Git.Config
|
||||
import Config
|
||||
import qualified Annex
|
||||
import Annex.CheckAttr
|
||||
import Types.Key
|
||||
|
@ -46,7 +46,7 @@ orderedList = do
|
|||
l' <- (lookupBackendName name :) <$> standard
|
||||
Annex.changeState $ \s -> s { Annex.backends = l' }
|
||||
return l'
|
||||
standard = fromRepo $ parseBackendList . Git.Config.get "annex.backends" ""
|
||||
standard = parseBackendList <$> getConfig "annex.backends" ""
|
||||
parseBackendList [] = list
|
||||
parseBackendList s = map lookupBackendName $ words s
|
||||
|
||||
|
|
|
@ -23,13 +23,13 @@ import Annex.Content
|
|||
import Utility.FileMode
|
||||
import Utility.TempFile
|
||||
import Logs.Location
|
||||
import Config
|
||||
import qualified Annex
|
||||
import qualified Git
|
||||
import qualified Git.Command
|
||||
import qualified Git.Ref
|
||||
import qualified Git.LsFiles as LsFiles
|
||||
import qualified Git.LsTree as LsTree
|
||||
import qualified Git.Config
|
||||
import qualified Backend
|
||||
import qualified Remote
|
||||
import qualified Annex.Branch
|
||||
|
@ -189,10 +189,10 @@ exclude smaller larger = S.toList $ remove larger $ S.fromList smaller
|
|||
-}
|
||||
bloomCapacity :: Annex Int
|
||||
bloomCapacity = fromMaybe 500000 . readish
|
||||
<$> fromRepo (Git.Config.get "annex.bloomcapacity" "")
|
||||
<$> getConfig "annex.bloomcapacity" ""
|
||||
bloomAccuracy :: Annex Int
|
||||
bloomAccuracy = fromMaybe 1000 . readish
|
||||
<$> fromRepo (Git.Config.get "annex.bloomaccuracy" "")
|
||||
<$> getConfig "annex.bloomaccuracy" ""
|
||||
bloomBitsHashes :: Annex (Int, Int)
|
||||
bloomBitsHashes = do
|
||||
capacity <- bloomCapacity
|
||||
|
|
|
@ -32,9 +32,8 @@ getConfig key def = fromRepo $ Git.Config.get key def
|
|||
{- Looks up a per-remote config setting in git config.
|
||||
- Failing that, tries looking for a global config option. -}
|
||||
getRemoteConfig :: Git.Repo -> ConfigKey -> String -> Annex String
|
||||
getRemoteConfig r key def = do
|
||||
def' <- getConfig key def
|
||||
fromRepo $ Git.Config.get (remoteConfig r key) def'
|
||||
getRemoteConfig r key def =
|
||||
getConfig (remoteConfig r key) =<< getConfig key def
|
||||
|
||||
{- A per-remote config setting in git config. -}
|
||||
remoteConfig :: Git.Repo -> ConfigKey -> String
|
||||
|
@ -85,9 +84,8 @@ getNumCopies v = perhaps (use v) =<< Annex.getState Annex.forcenumcopies
|
|||
where
|
||||
use (Just n) = return n
|
||||
use Nothing = perhaps (return 1) =<<
|
||||
readish <$> fromRepo (Git.Config.get config "1")
|
||||
readish <$> getConfig "annex.numcopies" "1"
|
||||
perhaps fallback = maybe fallback (return . id)
|
||||
config = "annex.numcopies"
|
||||
|
||||
{- Gets the trust level set for a remote in git config. -}
|
||||
getTrustLevel :: Git.Repo -> Annex (Maybe String)
|
||||
|
|
Loading…
Reference in a new issue