adjust standard preferred content to work better with git annex sync --all --content

backup: Use new "anything" terminal. This means that content that
is not unused, but has no associated file will be wanted by backup repos.

unwanted: "not anything" will result in any and all content moving
off of these repos.

incremental backup: Remove the "(include=* or unused)",
so it matches content that has no associated files
but is not unused.

client: Add a include=* to the expression. This limits it to matching
only files in the work tree. Without this change, sync --all --content
would match a key against the expression, and since it matches
exclude=archive/*, the client repo would have wanted the file content.
The "and not unused" would have kept unused objects out, but not
objects that were not known to be unused, or objects that another branch
referred to. In practice, everything would have flooded into client repos
without this change.
This commit is contained in:
Joey Hess 2015-06-16 17:17:51 -04:00
parent a4955542a3
commit 8268f7951e
3 changed files with 13 additions and 10 deletions

View file

@ -80,19 +80,19 @@ specialRemoteOnly _ = False
{- See doc/preferred_content.mdwn for explanations of these expressions. -}
standardPreferredContent :: StandardGroup -> PreferredContentExpression
standardPreferredContent ClientGroup = lastResort $
"((exclude=*/archive/* and exclude=archive/*) or (" ++ notArchived ++ ")) and not unused"
"include=* and ((exclude=*/archive/* and exclude=archive/*) or (" ++ notArchived ++ "))"
standardPreferredContent TransferGroup = lastResort $
"not (inallgroup=client and copies=client:2) and (" ++ standardPreferredContent ClientGroup ++ ")"
standardPreferredContent BackupGroup = "include=* or unused"
standardPreferredContent BackupGroup = "anything"
standardPreferredContent IncrementalBackupGroup = lastResort
"(include=* or unused) and (not copies=backup:1) and (not copies=incrementalbackup:1)"
"(not copies=backup:1) and (not copies=incrementalbackup:1)"
standardPreferredContent SmallArchiveGroup = lastResort $
"(include=*/archive/* or include=archive/*) and (" ++ standardPreferredContent FullArchiveGroup ++ ")"
standardPreferredContent FullArchiveGroup = lastResort notArchived
standardPreferredContent SourceGroup = "not (copies=1)"
standardPreferredContent ManualGroup = "present and (" ++ standardPreferredContent ClientGroup ++ ")"
standardPreferredContent PublicGroup = "inpreferreddir"
standardPreferredContent UnwantedGroup = "exclude=*"
standardPreferredContent UnwantedGroup = "not anything"
notArchived :: String
notArchived = "not (copies=archive:1 or copies=smallarchive:1)"

3
debian/changelog vendored
View file

@ -37,6 +37,9 @@ git-annex (5.20150616) UNRELEASED; urgency=medium
* sync: Add support for --all and --unused.
* Added new "anything" preferred content expression, which matches all
versions of all files.
* Standard preferred content for client, backup, incremental backup,
and unwanted groups have been adjusted to work better when used
with git annex sync --all --content.
* Fix incremental backup standard preferred content expression to match
its documentation, which says it does not want files that have reached
a backup repository.

View file

@ -19,10 +19,10 @@ The following standard groups are available:
### client
All content is wanted, unless it's for a file in a "archive" directory,
which has reached an archive repository, or is unused.
All content in the current working tree is wanted, unless it's for a
file in a "archive" directory, which has reached an archive repository.
`(((exclude=*/archive/* and exclude=archive/*) or (not (copies=archive:1 or copies=smallarchive:1))) and not unused) or approxlackingcopies=1`
`(include=* and ((exclude=*/archive/* and exclude=archive/*) or (not (copies=archive:1 or copies=smallarchive:1)))) or approxlackingcopies=1`
### transfer
@ -49,14 +49,14 @@ will be added later.
All content is wanted. Even content of old/deleted files.
`include=* or unused`
`anything`
### incremental backup
Only wants content that's not already backed up to another backup
or incremental backup repository.
`((include=* or unused) and (not copies=backup:1) and (not copies=incrementalbackup:1)) or approxlackingcopies=1`
`((not copies=backup:1) and (not copies=incrementalbackup:1)) or approxlackingcopies=1`
### small archive
@ -123,4 +123,4 @@ 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=*`
`not anything`