diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-25 23:44:55 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-25 23:44:55 -0400 |
commit | 9831bc36f7981da230c9dbf3704377b3bf74f50f (patch) | |
tree | 021e13e365a1ad56e4b621a571f52e111b8b45b3 /Limit.hs | |
parent | 62a272b330550a5db4836fd8104ca4b6a2032e39 (diff) |
per-IA-item content directories
Diffstat (limited to 'Limit.hs')
-rw-r--r-- | Limit.hs | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -1,6 +1,6 @@ {- user-specified limits on files to act on - - - Copyright 2011,2012 Joey Hess <joey@kitenet.net> + - Copyright 2011-2013 Joey Hess <joey@kitenet.net> - - Licensed under the GNU GPL version 3 or higher. -} @@ -88,9 +88,9 @@ limitExclude glob = Right $ const $ return . not . matchglob glob - once. Also, we use regex-TDFA because it's less buggy in its support - of non-unicode characters. -} matchglob :: String -> Annex.FileInfo -> Bool -matchglob glob (Annex.FileInfo { Annex.matchFile = f }) = +matchglob glob fi = case cregex of - Right r -> case execute r f of + Right r -> case execute r (Annex.matchFile fi) of Right (Just _) -> True _ -> False Left _ -> error $ "failed to compile regex: " ++ regex @@ -138,6 +138,11 @@ limitPresent u _ = Right $ const $ check $ \key -> do handle _ Nothing = return False handle a (Just (key, _)) = a key +{- Limit to content that is in a directory, anywhere in the repository tree -} +limitInDir :: FilePath -> MkLimit +limitInDir dir = const $ Right $ const $ \fi -> return $ + any (== dir) $ splitPath $ takeDirectory $ Annex.matchFile fi + {- Adds a limit to skip files not believed to have the specified number - of copies. -} addCopies :: String -> Annex () |