Added new "anything" preferred content expression, which matches all versions of all files.

This commit is contained in:
Joey Hess 2015-06-16 17:03:34 -04:00
parent 29c03145e6
commit 8c46ea22c2
4 changed files with 18 additions and 4 deletions

View file

@ -74,6 +74,7 @@ parseToken matchstandard matchgroupwanted checkpresent checkpreferreddir groupma
| t == "present" = use checkpresent | t == "present" = use checkpresent
| t == "inpreferreddir" = use checkpreferreddir | t == "inpreferreddir" = use checkpreferreddir
| t == "unused" = Right $ Operation limitUnused | t == "unused" = Right $ Operation limitUnused
| t == "anything" = Right $ Operation limitAnything
| otherwise = maybe (Left $ "near " ++ show t) use $ M.lookup k $ | otherwise = maybe (Left $ "near " ++ show t) use $ M.lookup k $
M.fromList M.fromList
[ ("include", limitInclude) [ ("include", limitInclude)

View file

@ -193,6 +193,10 @@ limitUnused :: MatchFiles Annex
limitUnused _ (MatchingFile _) = return False limitUnused _ (MatchingFile _) = return False
limitUnused _ (MatchingKey k) = S.member k <$> unusedKeys limitUnused _ (MatchingKey k) = S.member k <$> unusedKeys
{- Limit that matches any version of any file. -}
limitAnything :: MatchFiles Annex
limitAnything _ _ = return True
{- Adds a limit to skip files not believed to be present in all {- Adds a limit to skip files not believed to be present in all
- repositories in the specified group. -} - repositories in the specified group. -}
addInAllGroup :: String -> Annex () addInAllGroup :: String -> Annex ()

4
debian/changelog vendored
View file

@ -1,4 +1,4 @@
git-annex (5.20150529) UNRELEASED; urgency=medium git-annex (5.20150616) UNRELEASED; urgency=medium
* fromkey, registerurl: Improve handling of urls that happen to also * fromkey, registerurl: Improve handling of urls that happen to also
be parsable as strange keys. be parsable as strange keys.
@ -35,6 +35,8 @@ git-annex (5.20150529) UNRELEASED; urgency=medium
* info: Added json output for "backend usage", "numcopies stats", * info: Added json output for "backend usage", "numcopies stats",
"repositories containing these files", and "transfers in progress". "repositories containing these files", and "transfers in progress".
* sync: Add support for --all and --unused. * sync: Add support for --all and --unused.
* Added new "anything" preferred content expression, which matches all
versions of all files.
-- Joey Hess <id@joeyh.name> Sat, 30 May 2015 02:07:18 -0400 -- Joey Hess <id@joeyh.name> Sat, 30 May 2015 02:07:18 -0400

View file

@ -174,9 +174,10 @@ The --unused option makes git-annex operate on every key that `git annex
unused` has determined to be unused. The corresponding `unused` keyword unused` has determined to be unused. The corresponding `unused` keyword
in a preferred content expression also matches those keys. in a preferred content expression also matches those keys.
However, the latter doesn't make git-annex consider those keys. So However, using `unused` in a preferred content expression
when git-annex is only checking preferred content expressions against files doesn't make git-annex consider those keys. So when git-annex is
in the repository (which are obviously used), `unused` in a preferred only checking preferred content expressions against files in the
repository (which are obviously used), `unused` in a preferred
content expression won't match anything. content expression won't match anything.
So when is `unused` useful in a preferred content expression? So when is `unused` useful in a preferred content expression?
@ -189,6 +190,11 @@ So when is `unused` useful in a preferred content expression?
including unused ones, and take `unused` in preferred content expressions including unused ones, and take `unused` in preferred content expressions
into account. into account.
### difference: anything
The "anything" keyword can be used in a preferred content expression
to match any version of any file.
## upgrades ## upgrades
It's important that all clones of a repository can understand one-another's It's important that all clones of a repository can understand one-another's
@ -205,6 +211,7 @@ it assumes all files that are currently present are preferred content.
Here are recent changes to preferred content expressions, and the version Here are recent changes to preferred content expressions, and the version
they were added in. they were added in.
* "anything" 5.20150616
* "standard" 5.20140314 * "standard" 5.20140314
(only when used in a more complicated expression; "standard" by (only when used in a more complicated expression; "standard" by
itself has been supported for a long time) itself has been supported for a long time)