support findred and --branch with file matching options

* findref: Support file matching options: --include, --exclude,
  --want-get, --want-drop, --largerthan, --smallerthan, --accessedwithin
* Commands supporting --branch now apply file matching options --include,
  --exclude, --want-get, --want-drop to filenames from the branch.
  Previously, combining --branch with those would fail to match anything.
* add, import, findref: Support --time-limit.

This commit was sponsored by Jake Vosloo on Patreon.
This commit is contained in:
Joey Hess 2018-12-09 13:38:35 -04:00
parent 61b1f9deaf
commit 029ae8d4db
No known key found for this signature in database
GPG key ID: DB12DB0FF05F8F38
10 changed files with 54 additions and 26 deletions

View file

@ -211,18 +211,18 @@ parseKey = maybe (fail "invalid key") return . file2key
-- Options to match properties of annexed files.
annexedMatchingOptions :: [GlobalOption]
annexedMatchingOptions = concat
[ nonWorkTreeMatchingOptions'
[ keyMatchingOptions'
, fileMatchingOptions'
, combiningOptions
, timeLimitOption
]
-- Matching options that don't need to examine work tree files.
nonWorkTreeMatchingOptions :: [GlobalOption]
nonWorkTreeMatchingOptions = nonWorkTreeMatchingOptions' ++ combiningOptions
-- Matching options that can operate on keys as well as files.
keyMatchingOptions :: [GlobalOption]
keyMatchingOptions = keyMatchingOptions' ++ combiningOptions ++ timeLimitOption
nonWorkTreeMatchingOptions' :: [GlobalOption]
nonWorkTreeMatchingOptions' =
keyMatchingOptions' :: [GlobalOption]
keyMatchingOptions' =
[ globalSetter Limit.addIn $ strOption
( long "in" <> short 'i' <> metavar paramRemote
<> help "match files present in a remote"
@ -285,7 +285,7 @@ nonWorkTreeMatchingOptions' =
-- Options to match files which may not yet be annexed.
fileMatchingOptions :: [GlobalOption]
fileMatchingOptions = fileMatchingOptions' ++ combiningOptions
fileMatchingOptions = fileMatchingOptions' ++ combiningOptions ++ timeLimitOption
fileMatchingOptions' :: [GlobalOption]
fileMatchingOptions' =