diff options
author | Joey Hess <joey@kitenet.net> | 2014-03-15 16:17:01 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-03-15 16:17:01 -0400 |
commit | 3901089cec96419ab13fe05d4fbc3f040d018672 (patch) | |
tree | cf16927c3a17d42c05ccab9545557f2d33996255 /Logs | |
parent | fba52e2651cb8b2f26cdb4f38396cd9f55cf0985 (diff) |
vicfg: Allows editing preferred content expressions for groups.
This is stored in the git-annex branch, but not yet actually hooked up and
used.
Diffstat (limited to 'Logs')
-rw-r--r-- | Logs/PreferredContent.hs | 4 | ||||
-rw-r--r-- | Logs/PreferredContent/Raw.hs | 22 |
2 files changed, 23 insertions, 3 deletions
diff --git a/Logs/PreferredContent.hs b/Logs/PreferredContent.hs index 2bc5f08d6..93609da5e 100644 --- a/Logs/PreferredContent.hs +++ b/Logs/PreferredContent.hs @@ -1,6 +1,6 @@ {- git-annex preferred content matcher configuration - - - Copyright 2012 Joey Hess <joey@kitenet.net> + - Copyright 2012-2014 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. -} @@ -8,10 +8,12 @@ module Logs.PreferredContent ( preferredContentLog, preferredContentSet, + groupPreferredContentSet, isPreferredContent, preferredContentMap, preferredContentMapLoad, preferredContentMapRaw, + groupPreferredContentMapRaw, checkPreferredContentExpression, setStandardGroup, ) where diff --git a/Logs/PreferredContent/Raw.hs b/Logs/PreferredContent/Raw.hs index 63f6118e4..ce91c2dcd 100644 --- a/Logs/PreferredContent/Raw.hs +++ b/Logs/PreferredContent/Raw.hs @@ -1,6 +1,6 @@ {- unparsed preferred content expressions - - - Copyright 2012 Joey Hess <joey@kitenet.net> + - Copyright 2012-2014 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. -} @@ -15,17 +15,35 @@ import qualified Annex.Branch import qualified Annex import Logs import Logs.UUIDBased +import Logs.MapLog import Types.StandardGroups +import Types.Group {- Changes the preferred content configuration of a remote. -} preferredContentSet :: UUID -> PreferredContentExpression -> Annex () preferredContentSet uuid@(UUID _) val = do ts <- liftIO getPOSIXTime Annex.Branch.change preferredContentLog $ - showLog id . changeLog ts uuid val . parseLog Just + showLog id + . changeLog ts uuid val + . parseLog Just Annex.changeState $ \s -> s { Annex.preferredcontentmap = Nothing } preferredContentSet NoUUID _ = error "unknown UUID; cannot modify" +{- Changes the preferred content configuration of a group. -} +groupPreferredContentSet :: Group -> PreferredContentExpression -> Annex () +groupPreferredContentSet g val = do + ts <- liftIO getPOSIXTime + Annex.Branch.change groupPreferredContentLog $ + showMapLog id id + . changeMapLog ts g val + . parseMapLog Just Just + Annex.changeState $ \s -> s { Annex.preferredcontentmap = Nothing } + preferredContentMapRaw :: Annex (M.Map UUID PreferredContentExpression) preferredContentMapRaw = simpleMap . parseLog Just <$> Annex.Branch.get preferredContentLog + +groupPreferredContentMapRaw :: Annex (M.Map Group PreferredContentExpression) +groupPreferredContentMapRaw = simpleMap . parseMapLog Just Just + <$> Annex.Branch.get groupPreferredContentLog |