From 9214a810faa300862d3d847c9ee425e5605bccef Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 4 Oct 2012 15:48:59 -0400 Subject: added preferred-content log, and allow editing it with vicfg This includes a full parser for the boolean expressions in the log, that compiles them into Matchers. Those matchers are not used yet. A complication is that matching against an expression should never crash git-annex with an error. Instead, vicfg checks that the expressions parse. If a bad expression (or an expression understood by some future git-annex version) gets into the log, it'll be ignored. Most of the code in Limit couldn't fail anyway, but I did have to make limitCopies check its parameter first, and return an error if it's bad, rather than erroring at runtime. --- Logs/Group.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Logs/Group.hs') diff --git a/Logs/Group.hs b/Logs/Group.hs index 59f48f3a3..09d431e63 100644 --- a/Logs/Group.hs +++ b/Logs/Group.hs @@ -7,6 +7,7 @@ module Logs.Group ( groupChange, + groupSet, lookupGroups, groupMap, ) where @@ -39,7 +40,10 @@ groupChange uuid@(UUID _) modifier = do changeLog ts uuid (modifier curr) . parseLog (Just . S.fromList . words) Annex.changeState $ \s -> s { Annex.groupmap = Nothing } -groupChange NoUUID _ = error "unknown UUID; cannot modify group" +groupChange NoUUID _ = error "unknown UUID; cannot modify" + +groupSet :: UUID -> S.Set Group -> Annex () +groupSet u g = groupChange u (const g) {- Read the groupLog into a map. The map is cached for speed. -} groupMap :: Annex GroupMap -- cgit v1.2.3