webapp: configure new repos to use the standard preferred content settings

This commit is contained in:
Joey Hess 2012-10-10 15:35:10 -04:00
parent 3490977d97
commit 9da7dd8874
6 changed files with 15 additions and 8 deletions

View file

@ -7,11 +7,6 @@
module Annex.StandardGroups where
import Common.Annex
import Logs.Group
import qualified Data.Set as S
data StandardGroup = ClientGroup | TransferGroup | ArchiveGroup | BackupGroup
fromStandardGroup :: StandardGroup -> String
@ -33,6 +28,3 @@ preferredContent ClientGroup = "exclude=*/archive/*"
preferredContent TransferGroup = "not inallgroup=client and " ++ preferredContent ClientGroup
preferredContent ArchiveGroup = "not copies=archive:1"
preferredContent BackupGroup = "" -- all content is preferred
setStandardGroup :: UUID -> StandardGroup -> Annex ()
setStandardGroup u = groupSet u . S.singleton . fromStandardGroup

View file

@ -30,6 +30,7 @@ import Utility.Network
import Remote (prettyListUUIDs)
import Annex.UUID
import Annex.StandardGroups
import Logs.PreferredContent
import Yesod
import Data.Text (Text)

View file

@ -22,6 +22,7 @@ import Logs.Remote
import qualified Remote
import Types.Remote (RemoteConfig)
import Annex.StandardGroups
import Logs.PreferredContent
import Yesod
import Data.Text (Text)

View file

@ -19,6 +19,7 @@ import Utility.Yesod
import Utility.Rsync (rsyncUrlIsShell)
import Logs.Remote
import Remote
import Logs.PreferredContent
import Annex.StandardGroups
import Yesod

View file

@ -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"

2
debian/changelog vendored
View file

@ -1,6 +1,8 @@
git-annex (3.20121010) UNRELEASED; urgency=low
* Renamed --ingroup to --inallgroup.
* Standard groups changed to client, transfer, archive, and backup.
Each of these has its own standard preferred content setting.
-- Joey Hess <joeyh@debian.org> Wed, 10 Oct 2012 12:59:25 -0400