summaryrefslogtreecommitdiff
path: root/Backend
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-06-01 16:49:17 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-06-01 16:49:17 -0400
commit3d567aa64f263c6ee55c92e8b962087de063ebc8 (patch)
treeb900a87442363b33fd0fe9cba42923313f283676 /Backend
parent12e0e95916b81352b6f0dfdf95d3e623d4a12738 (diff)
Add --numcopies option.
Diffstat (limited to 'Backend')
-rw-r--r--Backend/File.hs12
1 files changed, 8 insertions, 4 deletions
diff --git a/Backend/File.hs b/Backend/File.hs
index b86413e40..543f02af7 100644
--- a/Backend/File.hs
+++ b/Backend/File.hs
@@ -152,12 +152,16 @@ showTriedRemotes remotes =
showLongNote $ "Unable to access these remotes: " ++
(join ", " $ map Remote.name remotes)
+{- If a value is specified, it is used; otherwise the default is looked up
+ - in git config. forcenumcopies overrides everything. -}
getNumCopies :: Maybe Int -> Annex Int
-getNumCopies (Just n) = return n
-getNumCopies Nothing = do
- g <- Annex.gitRepo
- return $ read $ Git.configGet g config "1"
+getNumCopies v =
+ Annex.getState Annex.forcenumcopies >>= maybe (use v) (return . id)
where
+ use (Just n) = return n
+ use Nothing = do
+ g <- Annex.gitRepo
+ return $ read $ Git.configGet g config "1"
config = "annex.numcopies"
{- Ideally, all keys have file size metadata. Old keys may not. -}