summaryrefslogtreecommitdiff
path: root/Logs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-21 18:08:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-21 18:08:56 -0400
commitd71baf07108c4903c444175ca482af1ed4cca1b4 (patch)
tree571818e459afc7722f5fc8c109f5502b8748988f /Logs
parentd44bd607d4fd18eadabe3c7693ebcf1c74aae63e (diff)
reorg
Diffstat (limited to 'Logs')
-rw-r--r--Logs/NumCopies.hs65
1 files changed, 0 insertions, 65 deletions
diff --git a/Logs/NumCopies.hs b/Logs/NumCopies.hs
index 8f1a09301..5cce61ce6 100644
--- a/Logs/NumCopies.hs
+++ b/Logs/NumCopies.hs
@@ -8,16 +8,9 @@
{-# OPTIONS_GHC -fno-warn-orphans #-}
module Logs.NumCopies (
- module Types.NumCopies,
setGlobalNumCopies,
getGlobalNumCopies,
globalNumCopiesLoad,
- getFileNumCopies,
- getGlobalFileNumCopies,
- getNumCopies,
- numCopiesCheck,
- deprecatedNumCopies,
- defaultNumCopies
) where
import Common.Annex
@@ -25,9 +18,6 @@ import qualified Annex
import Types.NumCopies
import Logs
import Logs.SingleValue
-import Logs.Trust
-import Annex.CheckAttr
-import qualified Remote
instance SingleValueSerializable NumCopies where
serialize (NumCopies n) = show n
@@ -46,58 +36,3 @@ globalNumCopiesLoad = do
v <- getLog numcopiesLog
Annex.changeState $ \s -> s { Annex.globalnumcopies = v }
return v
-
-defaultNumCopies :: NumCopies
-defaultNumCopies = NumCopies 1
-
-fromSources :: [Annex (Maybe NumCopies)] -> Annex NumCopies
-fromSources = fromMaybe defaultNumCopies <$$> getM id
-
-{- The git config annex.numcopies is deprecated. -}
-deprecatedNumCopies :: Annex (Maybe NumCopies)
-deprecatedNumCopies = annexNumCopies <$> Annex.getGitConfig
-
-{- Value forced on the command line by --numcopies. -}
-getForcedNumCopies :: Annex (Maybe NumCopies)
-getForcedNumCopies = Annex.getState Annex.forcenumcopies
-
-{- Numcopies value from any of the non-.gitattributes configuration
- - sources. -}
-getNumCopies :: Annex NumCopies
-getNumCopies = fromSources
- [ getForcedNumCopies
- , getGlobalNumCopies
- , deprecatedNumCopies
- ]
-
-{- Numcopies value for a file, from any configuration source, including the
- - deprecated git config. -}
-getFileNumCopies :: FilePath -> Annex NumCopies
-getFileNumCopies f = fromSources
- [ getForcedNumCopies
- , getFileNumCopies' f
- , deprecatedNumCopies
- ]
-
-{- This is the globally visible numcopies value for a file. So it does
- - not include local configuration in the git config or command line
- - options. -}
-getGlobalFileNumCopies :: FilePath -> Annex NumCopies
-getGlobalFileNumCopies f = fromSources
- [ getFileNumCopies' f
- ]
-
-getFileNumCopies' :: FilePath -> Annex (Maybe NumCopies)
-getFileNumCopies' file = maybe getGlobalNumCopies (return . Just) =<< getattr
- where
- getattr = (NumCopies <$$> readish)
- <$> checkAttr "annex.numcopies" file
-
-{- Checks if numcopies are satisfied for a file by running a comparison
- - between the number of (not untrusted) copies that are
- - belived to exist, and the configured value. -}
-numCopiesCheck :: FilePath -> Key -> (Int -> Int -> v) -> Annex v
-numCopiesCheck file key vs = do
- NumCopies needed <- getFileNumCopies file
- have <- trustExclude UnTrusted =<< Remote.keyLocations key
- return $ length have `vs` needed