summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-10 16:23:41 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-10 16:23:41 -0400
commitfde7c97ffd0ad175918f270571febfc893defd55 (patch)
treea99b1d1f41e9ca08abee8ed2aaecbb73d5240fd4
parent7053033f7708c2e432b3ad3e62356bd395932899 (diff)
ui for selecting a repository group
-rw-r--r--Logs/Group.hs10
-rw-r--r--Logs/PreferredContent.hs5
-rw-r--r--Types/StandardGroups.hs6
3 files changed, 9 insertions, 12 deletions
diff --git a/Logs/Group.hs b/Logs/Group.hs
index a58eafe92..56363f857 100644
--- a/Logs/Group.hs
+++ b/Logs/Group.hs
@@ -68,9 +68,7 @@ makeGroupMap byuuid = GroupMap byuuid bygroup
explode (u, s) = map (\g -> (g, S.singleton u)) (S.toList s)
{- If a repository is in exactly one standard group, returns it. -}
-getStandardGroup :: UUID -> GroupMap -> Maybe StandardGroup
-getStandardGroup u m = maybe Nothing go $ u `M.lookup` groupsByUUID m
- where
- go s = case catMaybes $ map toStandardGroup $ S.toList s of
- [g] -> Just g
- _ -> Nothing
+getStandardGroup :: S.Set Group -> Maybe StandardGroup
+getStandardGroup s = case catMaybes $ map toStandardGroup $ S.toList s of
+ [g] -> Just g
+ _ -> Nothing
diff --git a/Logs/PreferredContent.hs b/Logs/PreferredContent.hs
index 840c36155..9bb915983 100644
--- a/Logs/PreferredContent.hs
+++ b/Logs/PreferredContent.hs
@@ -89,9 +89,8 @@ makeMatcher groupmap u s
{- Standard matchers are pre-defined for some groups. If none is defined,
- or a repository is in multiple groups with standard matchers, match all. -}
standardMatcher :: GroupMap -> UUID -> Utility.Matcher.Matcher MatchFiles
-standardMatcher m u = maybe matchAll use (getStandardGroup u m)
- where
- use = makeMatcher m u . preferredContent
+standardMatcher m u = maybe matchAll (makeMatcher m u . preferredContent) $
+ getStandardGroup =<< u `M.lookup` groupsByUUID m
matchAll :: Utility.Matcher.Matcher MatchFiles
matchAll = Utility.Matcher.generate []
diff --git a/Types/StandardGroups.hs b/Types/StandardGroups.hs
index 151fc3304..32e2cb3af 100644
--- a/Types/StandardGroups.hs
+++ b/Types/StandardGroups.hs
@@ -25,9 +25,9 @@ toStandardGroup _ = Nothing
descStandardGroup :: StandardGroup -> String
descStandardGroup ClientGroup = "client: a repository on your computer"
-descStandardGroup TransferGroup = "transfer: distributes data to clients"
-descStandardGroup ArchiveGroup = "archive: collect content that is not archived elsewhere"
-descStandardGroup BackupGroup = "backup: collects all content"
+descStandardGroup TransferGroup = "transfer: distributes files to clients"
+descStandardGroup ArchiveGroup = "archive: collects files that are not archived elsewhere"
+descStandardGroup BackupGroup = "backup: collects all files"
{- See doc/preferred_content.mdwn for explanations of these expressions. -}
preferredContent :: StandardGroup -> String