better archive directory handling

Adjust preferred content expressions so that content in archive directories
is preferred until it has reached an archive or smallarchive repository.
This commit is contained in:
Joey Hess 2013-04-06 18:29:52 -04:00
parent 0a77d4b716
commit 84de4a14ad
4 changed files with 28 additions and 18 deletions

View file

@ -55,21 +55,22 @@ descStandardGroup UnwantedGroup = "unwanted: remove content from this repository
{- See doc/preferred_content.mdwn for explanations of these expressions. -} {- See doc/preferred_content.mdwn for explanations of these expressions. -}
preferredContent :: StandardGroup -> String preferredContent :: StandardGroup -> String
preferredContent ClientGroup = lastResort preferredContent ClientGroup = lastResort $
"exclude=*/archive/* and exclude=archive/*" "(exclude=*/archive/* and exclude=archive/*) or (" ++ notArchived ++ ")"
preferredContent TransferGroup = lastResort preferredContent TransferGroup = lastResort $
"not (inallgroup=client and copies=client:2) and " ++ preferredContent ClientGroup "not (inallgroup=client and copies=client:2) and (" ++ preferredContent ClientGroup ++ ")"
preferredContent BackupGroup = "include=*" preferredContent BackupGroup = "include=*"
preferredContent IncrementalBackupGroup = lastResort preferredContent IncrementalBackupGroup = lastResort $
"include=* and (not copies=incrementalbackup:1)" "include=* and (not copies=incrementalbackup:1)"
preferredContent SmallArchiveGroup = lastResort $ preferredContent SmallArchiveGroup = lastResort $
"(include=*/archive/* or include=archive/*) and " ++ preferredContent FullArchiveGroup "(include=*/archive/* or include=archive/*) and (" ++ preferredContent FullArchiveGroup ++ ")"
preferredContent FullArchiveGroup = lastResort preferredContent FullArchiveGroup = lastResort notArchived
"not (copies=archive:1 or copies=smallarchive:1)"
preferredContent SourceGroup = "not (copies=1)" preferredContent SourceGroup = "not (copies=1)"
preferredContent ManualGroup = lastResort preferredContent ManualGroup = "present and (" ++ preferredContent ClientGroup ++ ")"
"present and exclude=*/archive/* and exclude=archive/*"
preferredContent UnwantedGroup = "exclude=*" preferredContent UnwantedGroup = "exclude=*"
notArchived :: String
notArchived = "not (copies=archive:1 or copies=smallarchive:1)"
{- Most repositories want any content that is only on untrusted {- Most repositories want any content that is only on untrusted
- or dead repositories. -} - or dead repositories. -}

3
debian/changelog vendored
View file

@ -6,6 +6,9 @@ git-annex (4.20130406) UNRELEASED; urgency=low
remotes, to avoid delays. remotes, to avoid delays.
Thanks, guilhem for the patch. Thanks, guilhem for the patch.
* Bugfix: Direct mode no longer repeatedly checksums duplicated files. * Bugfix: Direct mode no longer repeatedly checksums duplicated files.
* Adjust preferred content expressions so that content in archive
directories is preferred until it has reached an archive or smallarchive
repository.
-- Joey Hess <joeyh@debian.org> Sat, 06 Apr 2013 15:24:15 -0400 -- Joey Hess <joeyh@debian.org> Sat, 06 Apr 2013 15:24:15 -0400

View file

@ -86,9 +86,10 @@ any repository that can will back it up.)
### client ### client
All content is preferred, unless it's in a "archive" directory. All content is preferred, unless it's for a file in a "archive" directory,
which has reached an archive repository.
`(exclude=*/archive/* and exclude=archive/*) or (not copies=semitrusted+:1)` `((exclude=*/archive/* and exclude=archive/*) or (not (copies=archive:1 or copies=smallarchive:1))) or (not copies=semitrusted+:1)`
### transfer ### transfer
@ -100,7 +101,7 @@ USB drive used in a sneakernet.
The preferred content expression for these causes them to get and retain The preferred content expression for these causes them to get and retain
data until all clients have a copy. data until all clients have a copy.
`(not (inallgroup=client and copies=client:2) and exclude=*/archive/* and exclude=archive/*) or (not copies=semitrusted+:1)` `(not (inallgroup=client and copies=client:2) and ($client)`
The "copies=client:2" part of the above handles the case where The "copies=client:2" part of the above handles the case where
there is only one client repository. It makes a transfer repository there is only one client repository. It makes a transfer repository
@ -152,15 +153,18 @@ data until a copy has been sent to some other repository.
### manual ### manual
This gives you full manual control over what content is stored in the This gives you nearly full manual control over what content is stored in the
repository. This allows using the [[assistant]] without it trying to keep a repository. This allows using the [[assistant]] without it trying to keep a
local copy of every file. Instead, you can manually run `git annex get`, local copy of every file. Instead, you can manually run `git annex get`,
`git annex drop`, etc to manage content. `git annex drop`, etc to manage content. Only content that is present
is preferred.
Only content that is present is preferred. Content in "archive" The exception to this manual control is that content that a client
directories is never preferred. repository would not want is not preferred. So, files in archive
directories are not preferred once their content has
reached an archive repository.
`(present and exclude=*/archive/* and exclude=archive/*) or (not copies=semitrusted+:1)` `present and ($client)`
### unwanted ### unwanted

View file

@ -27,3 +27,5 @@ Something vaguely like this should work as the preferred content
expression for the clients: expression for the clients:
exclude=archive/* or (include=archive/* and (not (copies=archive:1 or copies=smallarchive:1))) exclude=archive/* or (include=archive/* and (not (copies=archive:1 or copies=smallarchive:1)))
> [[done]] --[[Joey]]