aboutsummaryrefslogtreecommitdiff
path: root/Config.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Config.hs')
-rw-r--r--Config.hs11
1 files changed, 9 insertions, 2 deletions
diff --git a/Config.hs b/Config.hs
index 2eaf17bf8..b732f982f 100644
--- a/Config.hs
+++ b/Config.hs
@@ -12,6 +12,7 @@ import qualified Git
import qualified Git.Config
import qualified Git.Command
import qualified Annex
+import qualified Types.Remote as Remote
type UnqualifiedConfigKey = String
data ConfigKey = ConfigKey String
@@ -50,10 +51,15 @@ remoteCost c def = case remoteAnnexCostCommand c of
readProcess "sh" ["-c", cmd]
_ -> return $ fromMaybe def $ remoteAnnexCost c
+setRemoteCost :: Remote -> Int -> Annex ()
+setRemoteCost r c = setConfig (remoteConfig (Remote.repo r) "cost") (show c)
+
cheapRemoteCost :: Int
cheapRemoteCost = 100
semiCheapRemoteCost :: Int
semiCheapRemoteCost = 110
+semiExpensiveRemoteCost :: Int
+semiExpensiveRemoteCost = 175
expensiveRemoteCost :: Int
expensiveRemoteCost = 200
veryExpensiveRemoteCost :: Int
@@ -68,9 +74,10 @@ prop_cost_sane :: Bool
prop_cost_sane = False `notElem`
[ expensiveRemoteCost > 0
, cheapRemoteCost < semiCheapRemoteCost
- , semiCheapRemoteCost < expensiveRemoteCost
+ , semiCheapRemoteCost < semiExpensiveRemoteCost
+ , semiExpensiveRemoteCost < expensiveRemoteCost
, cheapRemoteCost + encryptedRemoteCostAdj > semiCheapRemoteCost
- , cheapRemoteCost + encryptedRemoteCostAdj < expensiveRemoteCost
+ , cheapRemoteCost + encryptedRemoteCostAdj < semiExpensiveRemoteCost
, semiCheapRemoteCost + encryptedRemoteCostAdj < expensiveRemoteCost
]