summaryrefslogtreecommitdiff
path: root/Logs/PreferredContent.hs
diff options
context:
space:
mode:
Diffstat (limited to 'Logs/PreferredContent.hs')
-rw-r--r--Logs/PreferredContent.hs10
1 files changed, 10 insertions, 0 deletions
diff --git a/Logs/PreferredContent.hs b/Logs/PreferredContent.hs
index e31aa7bae..ed6dbb43e 100644
--- a/Logs/PreferredContent.hs
+++ b/Logs/PreferredContent.hs
@@ -11,6 +11,7 @@ module Logs.PreferredContent (
preferredContentMap,
preferredContentMapRaw,
checkPreferredContentExpression,
+ setStandardGroup,
) where
import qualified Data.Map as M
@@ -131,3 +132,12 @@ tokenizeMatcher :: String -> [String]
tokenizeMatcher = filter (not . null ) . concatMap splitparens . words
where
splitparens = segmentDelim (`elem` "()")
+
+{- Puts a UUID in a standard group, and sets its preferred content to use
+ - the standard expression for that group, unless something is already set. -}
+setStandardGroup :: UUID -> StandardGroup -> Annex ()
+setStandardGroup u g = do
+ groupSet u $ S.singleton $ fromStandardGroup g
+ m <- preferredContentMap
+ unless (isJust $ M.lookup u m) $
+ preferredContentSet u "standard"