Merge branch 'master' into bloom

Conflicts:
	debian/changelog
This commit is contained in:
Joey Hess 2012-03-12 16:32:29 -04:00
commit 94aff8b878
6 changed files with 46 additions and 16 deletions

View file

@ -228,12 +228,19 @@ showSizeKeys d = total ++ missingnote
" keys of unknown size"
staleSize :: String -> (Git.Repo -> FilePath) -> Stat
staleSize label dirspec = do
keys <- lift (Command.Unused.staleKeys dirspec)
if null keys
then nostat
else stat label $ json (++ aside "clean up with git-annex unused") $
return $ showSizeKeys $ foldKeys keys
staleSize label dirspec = go =<< lift (Command.Unused.staleKeys dirspec)
where
go [] = nostat
go keys = onsize =<< sum <$> keysizes keys
onsize 0 = nostat
onsize size = stat label $
json (++ aside "clean up with git-annex unused") $
return $ roughSize storageUnits False size
keysizes keys = map (fromIntegral . fileSize) <$> stats keys
stats keys = do
dir <- lift $ fromRepo dirspec
liftIO $ forM keys $ \k ->
getFileStatus (dir </> keyFile k)
aside :: String -> String
aside s = " (" ++ s ++ ")"