dropunused: Significantly sped up; only read unused log file once.

This commit is contained in:
Joey Hess 2011-03-23 23:47:02 -04:00
parent 6246b807f7
commit 03fdd0d56e
2 changed files with 9 additions and 4 deletions

View file

@ -27,12 +27,16 @@ command = [repoCommand "dropunused" (paramRepeating paramNumber) seek
"drop unused file content"]
seek :: [CommandSeek]
seek = [withStrings start]
seek = [withUnusedMap]
{- Drops unused content by number. -}
start :: CommandStartString
start s = notBareRepo $ do
{- Read unusedlog once, and pass the map to each start action. -}
withUnusedMap :: CommandSeek
withUnusedMap params = do
m <- readUnusedLog
return $ map (start m) params
start :: M.Map String Key -> CommandStartString
start m s = notBareRepo $ do
case M.lookup s m of
Nothing -> return Nothing
Just key -> do