wired preferred content up to get, copy, and drop --auto
This commit is contained in:
parent
888981eaae
commit
71fd18a97f
8 changed files with 104 additions and 9 deletions
|
@ -7,6 +7,7 @@
|
|||
|
||||
module Logs.PreferredContent (
|
||||
preferredContentSet,
|
||||
isPreferredContent,
|
||||
preferredContentMap,
|
||||
preferredContentMapRaw,
|
||||
checkPreferredContentExpression,
|
||||
|
@ -20,8 +21,10 @@ import Common.Annex
|
|||
import qualified Annex.Branch
|
||||
import qualified Annex
|
||||
import Logs.UUIDBased
|
||||
import Limit (MatchFiles, limitInclude, limitExclude, limitIn, limitCopies, limitInBackend)
|
||||
import Limit (MatchFiles, AssumeNotPresent, limitInclude, limitExclude, limitIn, limitCopies, limitInBackend)
|
||||
import qualified Utility.Matcher
|
||||
import Annex.UUID
|
||||
import Git.FilePath
|
||||
|
||||
{- Filename of preferred-content.log. -}
|
||||
preferredContentLog :: FilePath
|
||||
|
@ -36,6 +39,18 @@ preferredContentSet uuid@(UUID _) val = do
|
|||
Annex.changeState $ \s -> s { Annex.groupmap = Nothing }
|
||||
preferredContentSet NoUUID _ = error "unknown UUID; cannot modify"
|
||||
|
||||
{- Checks if a file is preferred content for the specified repository
|
||||
- (or the current repository if none is specified). -}
|
||||
isPreferredContent :: Maybe UUID -> AssumeNotPresent -> TopFilePath -> Annex Bool
|
||||
isPreferredContent mu notpresent file = do
|
||||
u <- maybe getUUID return mu
|
||||
m <- preferredContentMap
|
||||
case M.lookup u m of
|
||||
Nothing -> return True
|
||||
Just matcher ->
|
||||
Utility.Matcher.matchM2 matcher notpresent $
|
||||
getTopFilePath file
|
||||
|
||||
{- Read the preferredContentLog into a map. The map is cached for speed. -}
|
||||
preferredContentMap :: Annex Annex.PreferredContentMap
|
||||
preferredContentMap = do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue