added --unlocked and --locked
This commit is contained in:
parent
fda1bdd679
commit
b13a350556
6 changed files with 48 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
git-annex (7.20190913) UNRELEASED; urgency=medium
|
git-annex (7.20190913) UNRELEASED; urgency=medium
|
||||||
|
|
||||||
* Added --mimetype and --mimeencoding file matching options.
|
* Added --mimetype and --mimeencoding file matching options.
|
||||||
|
* Added --unlocked and --locked file matching options.
|
||||||
|
|
||||||
-- Joey Hess <id@joeyh.name> Thu, 19 Sep 2019 11:11:19 -0400
|
-- Joey Hess <id@joeyh.name> Thu, 19 Sep 2019 11:11:19 -0400
|
||||||
|
|
||||||
|
|
|
@ -292,6 +292,16 @@ keyMatchingOptions' =
|
||||||
<> help "match files by mime encoding"
|
<> help "match files by mime encoding"
|
||||||
<> hidden
|
<> hidden
|
||||||
)
|
)
|
||||||
|
, globalFlag Limit.addUnlocked
|
||||||
|
( long "unlocked"
|
||||||
|
<> help "match files that are unlocked"
|
||||||
|
<> hidden
|
||||||
|
)
|
||||||
|
, globalFlag Limit.addLocked
|
||||||
|
( long "locked"
|
||||||
|
<> help "match files that are locked"
|
||||||
|
<> hidden
|
||||||
|
)
|
||||||
]
|
]
|
||||||
|
|
||||||
-- Options to match files which may not yet be annexed.
|
-- Options to match files which may not yet be annexed.
|
||||||
|
|
16
Limit.hs
16
Limit.hs
|
@ -129,6 +129,22 @@ matchMagic _limitname querymagic selectprovidedinfo (Just magic) glob = Right $
|
||||||
matchMagic limitname _ _ Nothing _ =
|
matchMagic limitname _ _ Nothing _ =
|
||||||
Left $ "unable to load magic database; \""++limitname++"\" cannot be used"
|
Left $ "unable to load magic database; \""++limitname++"\" cannot be used"
|
||||||
|
|
||||||
|
addUnlocked :: Annex ()
|
||||||
|
addUnlocked = addLimit $ Right $ const $ matchLockStatus False
|
||||||
|
|
||||||
|
addLocked :: Annex ()
|
||||||
|
addLocked = addLimit $ Right $ const $ matchLockStatus True
|
||||||
|
|
||||||
|
matchLockStatus :: Bool -> MatchInfo -> Annex Bool
|
||||||
|
matchLockStatus _ (MatchingKey _ _) = pure False
|
||||||
|
matchLockStatus _ (MatchingInfo _) = pure False
|
||||||
|
matchLockStatus wantlocked (MatchingFile fi) = liftIO $ do
|
||||||
|
islocked <- isPointerFile (currFile fi) >>= \case
|
||||||
|
Just _key -> return False
|
||||||
|
Nothing -> isSymbolicLink
|
||||||
|
<$> getSymbolicLinkStatus (currFile fi)
|
||||||
|
return (islocked == wantlocked)
|
||||||
|
|
||||||
{- Adds a limit to skip files not believed to be present
|
{- Adds a limit to skip files not believed to be present
|
||||||
- in a specfied repository. Optionally on a prior date. -}
|
- in a specfied repository. Optionally on a prior date. -}
|
||||||
addIn :: String -> Annex ()
|
addIn :: String -> Annex ()
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
[[!comment format=mdwn
|
||||||
|
username="joey"
|
||||||
|
subject="""comment 2"""
|
||||||
|
date="2019-09-19T16:14:26Z"
|
||||||
|
content="""
|
||||||
|
`git status` only finds unlocked files that have recently been unlocked but
|
||||||
|
not committed. (In v5 there were no other kind, but it won't find them all
|
||||||
|
in v7.)
|
||||||
|
|
||||||
|
I've added a --unlocked option to find them.
|
||||||
|
"""]]
|
|
@ -159,6 +159,14 @@ in either of two repositories.
|
||||||
If the OS or filesystem does not support access times, this will not
|
If the OS or filesystem does not support access times, this will not
|
||||||
match any files.
|
match any files.
|
||||||
|
|
||||||
|
* `--unlocked`
|
||||||
|
|
||||||
|
Matches annexed files that are unlocked.
|
||||||
|
|
||||||
|
* `--locked`
|
||||||
|
|
||||||
|
Matches annexed files that are locked.
|
||||||
|
|
||||||
* `--mimetype=glob`
|
* `--mimetype=glob`
|
||||||
|
|
||||||
Looks up the MIME type of a file, and checks if the glob matches it.
|
Looks up the MIME type of a file, and checks if the glob matches it.
|
||||||
|
|
|
@ -1 +1,3 @@
|
||||||
As suggested at [[forum/Find_unlocked__47__locked_files]], can the file matching conditions be extended to be able to find unlocked files?
|
As suggested at [[forum/Find_unlocked__47__locked_files]], can the file matching conditions be extended to be able to find unlocked files?
|
||||||
|
|
||||||
|
> sure, [[done]] --[[Joey]]
|
||||||
|
|
Loading…
Reference in a new issue