diff options
author | Joey Hess <joey@kitenet.net> | 2014-03-13 18:51:44 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2014-03-13 18:51:44 -0400 |
commit | 4727e1dc1de161ad9517bcb4c101c66ac632284f (patch) | |
tree | 3c1ae9f83f91287244a717663288a22b324a68b1 /Limit.hs | |
parent | f00dff67bfe5c0dd8b66278d7ce2475d326f5716 (diff) |
theoretical optimisation of --in
Avoids looking up the remote each time, but in practice, does not result in
a measurable speedup.
Diffstat (limited to 'Limit.hs')
-rw-r--r-- | Limit.hs | 18 |
1 files changed, 8 insertions, 10 deletions
@@ -94,18 +94,16 @@ matchGlobFile glob = go {- Adds a limit to skip files not believed to be present - in a specfied repository. Optionally on a prior date. -} addIn :: String -> Annex () -addIn = addLimit . limitIn - -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 +addIn s = addLimit =<< mk where (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 us <- Remote.keyLocations key return $ u `elem` us && u `S.notMember` notpresent |