theoretical optimisation of --in
Avoids looking up the remote each time, but in practice, does not result in a measurable speedup.
This commit is contained in:
parent
a6db329117
commit
83ccce68a2
1 changed files with 8 additions and 10 deletions
18
Limit.hs
18
Limit.hs
|
@ -94,18 +94,16 @@ matchGlobFile glob = go
|
||||||
{- 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 ()
|
||||||
addIn = addLimit . limitIn
|
addIn s = addLimit =<< mk
|
||||||
|
|
||||||
limitIn :: MkLimit
|
|
||||||
limitIn s = Right $ \notpresent -> checkKey $ \key ->
|
|
||||||
if name == "."
|
|
||||||
then if null date
|
|
||||||
then inhere notpresent key
|
|
||||||
else inuuid notpresent key =<< getUUID
|
|
||||||
else inuuid notpresent key =<< Remote.nameToUUID name
|
|
||||||
where
|
where
|
||||||
(name, date) = separate (== '@') s
|
(name, date) = separate (== '@') s
|
||||||
inuuid notpresent key u
|
mk
|
||||||
|
| name == "." = if null date
|
||||||
|
then use inhere
|
||||||
|
else use . inuuid =<< getUUID
|
||||||
|
| otherwise = use . inuuid =<< Remote.nameToUUID name
|
||||||
|
use a = return $ Right $ \notpresent -> checkKey (a notpresent)
|
||||||
|
inuuid u notpresent key
|
||||||
| null date = do
|
| null date = do
|
||||||
us <- Remote.keyLocations key
|
us <- Remote.keyLocations key
|
||||||
return $ u `elem` us && u `S.notMember` notpresent
|
return $ u `elem` us && u `S.notMember` notpresent
|
||||||
|
|
Loading…
Reference in a new issue