summaryrefslogtreecommitdiff
path: root/Annex
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-10 15:15:56 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-10 15:15:56 -0400
commit2d1e48b3547b4df855d7166e7cee9fd3c00b8ec5 (patch)
tree2a63a72311e68040983ff08cea942a406ae3f1b0 /Annex
parenta5c3a2fbf523a22fbfcc7b7d419a56b88e6d8d12 (diff)
refactor
Diffstat (limited to 'Annex')
-rw-r--r--Annex/Groups.hs30
1 files changed, 30 insertions, 0 deletions
diff --git a/Annex/Groups.hs b/Annex/Groups.hs
new file mode 100644
index 000000000..3b4449514
--- /dev/null
+++ b/Annex/Groups.hs
@@ -0,0 +1,30 @@
+{- git-annex standard repository groups
+ -
+ - Copyright 2012 Joey Hess <joey@kitenet.net>
+ -
+ - Licensed under the GNU GPL version 3 or higher.
+ -}
+
+module Annex.Groups where
+
+data StandardGroup = ClientGroup | TransferGroup | ArchiveGroup | BackupGroup
+
+fromStandardGroup :: StandardGroup -> String
+fromStandardGroup ClientGroup = "client"
+fromStandardGroup TransferGroup = "transfer"
+fromStandardGroup ArchiveGroup = "archive"
+fromStandardGroup BackupGroup = "backup"
+
+toStandardGroup :: String -> Maybe StandardGroup
+toStandardGroup "client" = Just ClientGroup
+toStandardGroup "transfer" = Just TransferGroup
+toStandardGroup "archive" = Just ArchiveGroup
+toStandardGroup "backup" = Just BackupGroup
+toStandardGroup _ = Nothing
+
+{- See doc/preferred_content.mdwn for explanations of these expressions. -}
+preferredContent :: StandardGroup -> String
+preferredContent ClientGroup = "exclude=*/archive/*"
+preferredContent TransferGroup = "not inallgroup=client and " ++ preferredContent ClientGroup
+preferredContent ArchiveGroup = "not copies=archive:1"
+preferredContent BackupGroup = "" -- all content is preferred