aboutsummaryrefslogtreecommitdiff
path: root/Logs.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2014-01-20 16:47:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2014-01-20 16:47:56 -0400
commit8cd1d9ed5ebf96d9e39116f63900ccd7be8d907e (patch)
tree9d4bb88a930f28120de40556eeec906de7df39d0 /Logs.hs
parent5534e89870b7d0885f6fe113068c0514a03a74bd (diff)
global numcopies setting
* numcopies: New command, sets global numcopies value that is seen by all clones of a repository. * The annex.numcopies git config setting is deprecated. Once the numcopies command is used to set the global number of copies, any annex.numcopies git configs will be ignored. * assistant: Make the prefs page set the global numcopies. This global numcopies setting is needed to let preferred content expressions operate on numcopies. It's also convenient, because typically if you want git-annex to preserve N copies of files in a repo, you want it to do that no matter which repo it's running in. Making it global avoids needing to warn the user about gotchas involving inconsistent annex.numcopies settings. (See changes to doc/numcopies.mdwn.) Added a new variety of git-annex branch log file, that holds only 1 value. Will probably be useful for other stuff later. This commit was sponsored by Nicolas Pouillard.
Diffstat (limited to 'Logs.hs')
-rw-r--r--Logs.hs13
1 files changed, 12 insertions, 1 deletions
diff --git a/Logs.hs b/Logs.hs
index 2952d6920..828a73dc7 100644
--- a/Logs.hs
+++ b/Logs.hs
@@ -11,7 +11,11 @@ import Common.Annex
import Types.Key
{- There are several varieties of log file formats. -}
-data LogVariety = UUIDBasedLog | NewUUIDBasedLog | PresenceLog Key
+data LogVariety
+ = UUIDBasedLog
+ | NewUUIDBasedLog
+ | PresenceLog Key
+ | SingleValueLog
deriving (Show)
{- Converts a path from the git-annex branch into one of the varieties
@@ -20,6 +24,7 @@ getLogVariety :: FilePath -> Maybe LogVariety
getLogVariety f
| f `elem` topLevelUUIDBasedLogs = Just UUIDBasedLog
| isRemoteStateLog f = Just NewUUIDBasedLog
+ | f == numcopiesLog = Just SingleValueLog
| otherwise = PresenceLog <$> firstJust (presenceLogs f)
{- All the uuid-based logs stored in the top of the git-annex branch. -}
@@ -43,6 +48,9 @@ presenceLogs f =
uuidLog :: FilePath
uuidLog = "uuid.log"
+numcopiesLog :: FilePath
+numcopiesLog = "numcopies.log"
+
remoteLog :: FilePath
remoteLog = "remote.log"
@@ -118,6 +126,7 @@ prop_logs_sane dummykey = all id
, expect isPresenceLog (getLogVariety $ locationLogFile dummykey)
, expect isPresenceLog (getLogVariety $ urlLogFile dummykey)
, expect isNewUUIDBasedLog (getLogVariety $ remoteStateLogFile dummykey)
+ , expect isSingleValueLog (getLogVariety $ numcopiesLog)
]
where
expect = maybe False
@@ -127,3 +136,5 @@ prop_logs_sane dummykey = all id
isNewUUIDBasedLog _ = False
isPresenceLog (PresenceLog k) = k == dummykey
isPresenceLog _ = False
+ isSingleValueLog SingleValueLog = True
+ isSingleValueLog _ = False