diff options
author | Joey Hess <joey@kitenet.net> | 2012-10-10 15:35:10 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2012-10-10 15:35:10 -0400 |
commit | da68a5b0942327096adfd63378c47c823e873178 (patch) | |
tree | 2952192f6d27ac6836a71a4c52181851a63fc46c /Logs | |
parent | 3a9d1edb4ce0c0b1c2b71598ad7000875ad82828 (diff) |
webapp: configure new repos to use the standard preferred content settings
Diffstat (limited to 'Logs')
-rw-r--r-- | Logs/PreferredContent.hs | 10 |
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" |