2012-10-10 19:15:56 +00:00
|
|
|
{- git-annex standard repository groups
|
|
|
|
-
|
|
|
|
- Copyright 2012 Joey Hess <joey@kitenet.net>
|
|
|
|
-
|
|
|
|
- Licensed under the GNU GPL version 3 or higher.
|
|
|
|
-}
|
|
|
|
|
2012-10-10 20:04:28 +00:00
|
|
|
module Types.StandardGroups where
|
2012-10-10 19:27:25 +00:00
|
|
|
|
2013-01-21 08:18:05 +00:00
|
|
|
data StandardGroup
|
|
|
|
= ClientGroup
|
|
|
|
| TransferGroup
|
|
|
|
| BackupGroup
|
|
|
|
| SmallArchiveGroup
|
|
|
|
| FullArchiveGroup
|
|
|
|
| SourceGroup
|
|
|
|
| ManualGroup
|
2012-10-10 20:04:28 +00:00
|
|
|
deriving (Eq, Ord, Enum, Bounded, Show)
|
2012-10-10 19:15:56 +00:00
|
|
|
|
|
|
|
fromStandardGroup :: StandardGroup -> String
|
|
|
|
fromStandardGroup ClientGroup = "client"
|
|
|
|
fromStandardGroup TransferGroup = "transfer"
|
|
|
|
fromStandardGroup BackupGroup = "backup"
|
2012-11-24 20:30:15 +00:00
|
|
|
fromStandardGroup SmallArchiveGroup = "smallarchive"
|
|
|
|
fromStandardGroup FullArchiveGroup = "archive"
|
2013-01-21 08:18:05 +00:00
|
|
|
fromStandardGroup SourceGroup = "source"
|
|
|
|
fromStandardGroup ManualGroup = "manual"
|
2012-10-10 19:15:56 +00:00
|
|
|
|
|
|
|
toStandardGroup :: String -> Maybe StandardGroup
|
|
|
|
toStandardGroup "client" = Just ClientGroup
|
|
|
|
toStandardGroup "transfer" = Just TransferGroup
|
|
|
|
toStandardGroup "backup" = Just BackupGroup
|
2012-11-24 20:30:15 +00:00
|
|
|
toStandardGroup "smallarchive" = Just SmallArchiveGroup
|
|
|
|
toStandardGroup "archive" = Just FullArchiveGroup
|
2013-01-21 08:18:05 +00:00
|
|
|
toStandardGroup "source" = Just SourceGroup
|
|
|
|
toStandardGroup "manual" = Just ManualGroup
|
2012-10-10 19:15:56 +00:00
|
|
|
toStandardGroup _ = Nothing
|
|
|
|
|
2012-10-10 20:04:28 +00:00
|
|
|
descStandardGroup :: StandardGroup -> String
|
|
|
|
descStandardGroup ClientGroup = "client: a repository on your computer"
|
2012-10-10 20:23:41 +00:00
|
|
|
descStandardGroup TransferGroup = "transfer: distributes files to clients"
|
2012-11-24 20:30:15 +00:00
|
|
|
descStandardGroup BackupGroup = "backup: backs up all files"
|
|
|
|
descStandardGroup SmallArchiveGroup = "small archive: archives files located in \"archive\" directories"
|
|
|
|
descStandardGroup FullArchiveGroup = "full archive: archives all files not archived elsewhere"
|
2013-01-21 08:18:05 +00:00
|
|
|
descStandardGroup SourceGroup = "file source: moves files on to other repositories"
|
|
|
|
descStandardGroup ManualGroup = "manual mode: only stores files you manually choose"
|
2012-10-10 20:04:28 +00:00
|
|
|
|
2012-10-10 19:15:56 +00:00
|
|
|
{- See doc/preferred_content.mdwn for explanations of these expressions. -}
|
|
|
|
preferredContent :: StandardGroup -> String
|
2012-11-24 20:30:15 +00:00
|
|
|
preferredContent ClientGroup = "exclude=*/archive/* and exclude=archive/*"
|
2012-10-14 20:21:18 +00:00
|
|
|
preferredContent TransferGroup = "not (inallgroup=client and copies=client:2) and " ++ preferredContent ClientGroup
|
2012-12-10 19:43:51 +00:00
|
|
|
preferredContent BackupGroup = "include=*"
|
2012-11-24 20:30:15 +00:00
|
|
|
preferredContent SmallArchiveGroup = "(include=*/archive/* or include=archive/*) and " ++ preferredContent FullArchiveGroup
|
|
|
|
preferredContent FullArchiveGroup = "not (copies=archive:1 or copies=smallarchive:1)"
|
2013-01-21 08:18:05 +00:00
|
|
|
preferredContent SourceGroup = "not (copies=1)"
|
2013-01-21 20:10:24 +00:00
|
|
|
preferredContent ManualGroup = "present and exclude=*/archive/* and exclude=archive/*"
|