summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-31 17:10:25 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-31 17:10:25 -0400
commit2fd64b0831cb3bb9366ba6a887ddfa3bdf119b5e (patch)
tree43cd36d56a0aee72a40f75d936d4a141fa969004
parent150a05edaa5f23c512dd352124b8da2399ff0cff (diff)
Adjust built-in preferred content expressions to make most types of repositories want content that is only located on untrusted or dead repositories.
-rw-r--r--Types/StandardGroups.hs27
-rw-r--r--debian/changelog3
-rw-r--r--doc/preferred_content.mdwn27
3 files changed, 44 insertions, 13 deletions
diff --git a/Types/StandardGroups.hs b/Types/StandardGroups.hs
index 8c19e14de..722136520 100644
--- a/Types/StandardGroups.hs
+++ b/Types/StandardGroups.hs
@@ -16,6 +16,7 @@ data StandardGroup
| FullArchiveGroup
| SourceGroup
| ManualGroup
+ | UnwantedGroup
deriving (Eq, Ord, Enum, Bounded, Show)
fromStandardGroup :: StandardGroup -> String
@@ -27,6 +28,7 @@ fromStandardGroup SmallArchiveGroup = "smallarchive"
fromStandardGroup FullArchiveGroup = "archive"
fromStandardGroup SourceGroup = "source"
fromStandardGroup ManualGroup = "manual"
+fromStandardGroup UnwantedGroup = "unwanted"
toStandardGroup :: String -> Maybe StandardGroup
toStandardGroup "client" = Just ClientGroup
@@ -37,6 +39,7 @@ toStandardGroup "smallarchive" = Just SmallArchiveGroup
toStandardGroup "archive" = Just FullArchiveGroup
toStandardGroup "source" = Just SourceGroup
toStandardGroup "manual" = Just ManualGroup
+toStandardGroup "unwanted" = Just UnwantedGroup
toStandardGroup _ = Nothing
descStandardGroup :: StandardGroup -> String
@@ -48,14 +51,26 @@ descStandardGroup SmallArchiveGroup = "small archive: archives files located in
descStandardGroup FullArchiveGroup = "full archive: archives all files not archived elsewhere"
descStandardGroup SourceGroup = "file source: moves files on to other repositories"
descStandardGroup ManualGroup = "manual mode: only stores files you manually choose"
+descStandardGroup UnwantedGroup "unwanted: a repository in the process of being removed"
{- See doc/preferred_content.mdwn for explanations of these expressions. -}
preferredContent :: StandardGroup -> String
-preferredContent ClientGroup = "exclude=*/archive/* and exclude=archive/*"
-preferredContent TransferGroup = "not (inallgroup=client and copies=client:2) and " ++ preferredContent ClientGroup
+preferredContent ClientGroup = normal
+ "exclude=*/archive/* and exclude=archive/*"
+preferredContent TransferGroup = normal $
+ "not (inallgroup=client and copies=client:2) and " ++ preferredContent ClientGroup
preferredContent BackupGroup = "include=*"
-preferredContent IncrementalBackupGroup = "include=* and (not copies=incrementalbackup:1)"
-preferredContent SmallArchiveGroup = "(include=*/archive/* or include=archive/*) and " ++ preferredContent FullArchiveGroup
-preferredContent FullArchiveGroup = "not (copies=archive:1 or copies=smallarchive:1)"
+preferredContent IncrementalBackupGroup = normal $
+ "include=* and (not copies=incrementalbackup:1)"
+preferredContent SmallArchiveGroup = normal $
+ "(include=*/archive/* or include=archive/*) and " ++ preferredContent FullArchiveGroup
+preferredContent FullArchiveGroup = normal $
+ "not (copies=archive:1 or copies=smallarchive:1)"
preferredContent SourceGroup = "not (copies=1)"
-preferredContent ManualGroup = "present and exclude=*/archive/* and exclude=archive/*"
+preferredContent ManualGroup = normal $
+ "present and exclude=*/archive/* and exclude=archive/*"
+preferredContent UnwantedGroup = "exclude=*"
+ where
+ {- Most repositories want any content that is only on untrusted
+ - or dead repositories. -}
+ normal s = "(" ++ s ++ ") or (not copies=semitrusted:1)"
diff --git a/debian/changelog b/debian/changelog
index cc61a25af..5c2a44a4e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -19,6 +19,9 @@ git-annex (4.20130324) UNRELEASED; urgency=low
* git-annex-shell: Passes rsync --bwlimit options on rsync.
Thanks, guilhem for the patch.
* webapp: Added UI to delete repositories. Closes: #689847
+ * Adjust built-in preferred content expressions to make most types
+ of repositories want content that is only located on untrusted or dead
+ repositories.
-- Joey Hess <joeyh@debian.org> Mon, 25 Mar 2013 10:21:46 -0400
diff --git a/doc/preferred_content.mdwn b/doc/preferred_content.mdwn
index 763e348f1..f8f937e4a 100644
--- a/doc/preferred_content.mdwn
+++ b/doc/preferred_content.mdwn
@@ -77,13 +77,18 @@ drop content that is present! Don't go there..
git-annex comes with some standard preferred content expressions, that can
be used with repositories that are in some pre-defined groups. To make a
repository use one of these, just set its preferred content expression
-to "standard", and put it in one of these groups:
+to "standard", and put it in one of these groups.
+
+(Note that most of these standard expressions also make the repository
+prefer any content that is only currently available on untrusted and
+dead repositories. So if an untrusted repository gets connected,
+any repository that can will back it up.)
### client
All content is preferred, unless it's in a "archive" directory.
-`exclude=*/archive/* and exclude=archive/*`
+`(exclude=*/archive/* and exclude=archive/*) or (not copies=semitrusted:1)`
### transfer
@@ -95,7 +100,7 @@ USB drive used in a sneakernet.
The preferred content expression for these causes them to get and retain
data until all clients have a copy.
-`not (inallgroup=client and copies=client:2) and exclude=*/archive/* and exclude=archive/*`
+`(not (inallgroup=client and copies=client:2) and exclude=*/archive/* and exclude=archive/*) or (not copies=semitrusted:1)`
The "copies=client:2" part of the above handles the case where
there is only one client repository. It makes a transfer repository
@@ -114,20 +119,20 @@ All content is preferred.
Only prefers content that's not already backed up to another backup
or incremental backup repository.
-`include=* and (not copies=backup:1) and (not copies=incrementalbackup:1)`
+`(include=* and (not copies=backup:1) and (not copies=incrementalbackup:1)) or (not copies=semitrusted:1)`
### small archive
Only prefers content that's located in an "archive" directory, and
only if it's not already been archived somewhere else.
-`(include=*/archive/* or include=archive/*) and not (copies=archive:1 or copies=smallarchive:1)`
+`((include=*/archive/* or include=archive/*) and not (copies=archive:1 or copies=smallarchive:1)) or (not copies=semitrusted:1)`
### full archive
All content is preferred, unless it's already been archived somewhere else.
-`not (copies=archive:1 or copies=smallarchive:1)`
+`(not (copies=archive:1 or copies=smallarchive:1)) or (not copies=semitrusted:1)`
Note that if you want to archive multiple copies (not a bad idea!),
you should instead configure all your archive repositories with a
@@ -155,4 +160,12 @@ local copy of every file. Instead, you can manually run `git annex get`,
Only content that is present is preferred. Content in "archive"
directories is never preferred.
-`present and exclude=*/archive/* and exclude=archive/*`
+`(present and exclude=*/archive/* and exclude=archive/*) or (not copies=semitrusted:1)`
+
+### unwanted
+
+Use for repositories that you don't want to exist. This will result
+in any content on them being moved away to other repositories. (Works
+best when the unwanted repository is also marked as untrusted or dead.)
+
+`exclude=*`