diff --git a/CHANGELOG b/CHANGELOG index ebadab2e88..4190ee79d1 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -23,7 +23,8 @@ git-annex (6.20180410) UNRELEASED; urgency=medium * Assistant: Fix installation of menus, icons, etc when run from within runshell. * import: Avoid buffering all filenames to be imported in memory. - * Improve memory use and speed of --all, by not buffering list of all keys. + * Improve memory use and speed of --all and git-annex info remote, + by not buffering list of all keys. -- Joey Hess Mon, 09 Apr 2018 14:03:28 -0400 diff --git a/Command/Info.hs b/Command/Info.hs index cc9c1b5fe0..c9a314056a 100644 --- a/Command/Info.hs +++ b/Command/Info.hs @@ -525,7 +525,11 @@ cachedRemoteData u = do case M.lookup u (repoData s) of Just v -> return v Nothing -> do - v <- foldKeys <$> lift (loggedKeysFor u) + let combinedata d uk = finishCheck uk >>= \case + Nothing -> return d + Just k -> return $ addKey k d + v <- lift $ foldM combinedata emptyKeyData + =<< loggedKeysFor' u put s { repoData = M.insert u v (repoData s) } return v diff --git a/Logs/Location.hs b/Logs/Location.hs index 621cca9716..725ce1a075 100644 --- a/Logs/Location.hs +++ b/Logs/Location.hs @@ -27,6 +27,7 @@ module Logs.Location ( finishCheck, loggedKeys, loggedKeysFor, + loggedKeysFor', ) where import Annex.Common @@ -139,10 +140,15 @@ loggedKeys' check = mapMaybe (defercheck <$$> locationLogFileKey) ) {- Finds all keys that have location log information indicating - - they are present for the specified repository. + - they are present in the specified repository. + - + - This does not stream well; use loggedKeysFor' for lazy streaming. -} loggedKeysFor :: UUID -> Annex [Key] -loggedKeysFor u = catMaybes <$> (mapM finishCheck =<< loggedKeys' isthere) +loggedKeysFor u = catMaybes <$> (mapM finishCheck =<< loggedKeysFor' u) + +loggedKeysFor' :: UUID -> Annex [Unchecked Key] +loggedKeysFor' u = loggedKeys' isthere where isthere k = do us <- loggedLocations k