info: Added "combined size of repositories containing these files" stat
when run on a directory This commit was sponsored by andrea rota.
This commit is contained in:
parent
dc6d1ad00f
commit
817ebb5765
2 changed files with 16 additions and 0 deletions
|
@ -14,6 +14,8 @@ git-annex (6.20180317) UNRELEASED; urgency=medium
|
|||
* Avoid running annex.http-headers-command more than once.
|
||||
* Enable HTTP connection reuse across multiple files, when git-annex
|
||||
uses http-conduit.
|
||||
* info: Added "combined size of repositories containing these files"
|
||||
stat when run on a directory.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Mon, 19 Mar 2018 23:13:59 -0400
|
||||
|
||||
|
|
|
@ -56,6 +56,15 @@ data KeyData = KeyData
|
|||
, backendsKeys :: M.Map KeyVariety Integer
|
||||
}
|
||||
|
||||
instance Monoid KeyData where
|
||||
mempty = KeyData 0 0 0 M.empty
|
||||
mappend a b = KeyData
|
||||
{ countKeys = countKeys a + countKeys b
|
||||
, sizeKeys = sizeKeys a + sizeKeys b
|
||||
, unknownSizeKeys = unknownSizeKeys a + unknownSizeKeys b
|
||||
, backendsKeys = backendsKeys a <> backendsKeys b
|
||||
}
|
||||
|
||||
data NumCopiesStats = NumCopiesStats
|
||||
{ numCopiesVarianceMap :: M.Map Variance Integer
|
||||
}
|
||||
|
@ -237,6 +246,7 @@ tree_slow_stats :: [FilePath -> Stat]
|
|||
tree_slow_stats =
|
||||
[ const numcopies_stats
|
||||
, const reposizes_stats
|
||||
, const reposizes_total
|
||||
]
|
||||
|
||||
file_stats :: FilePath -> Key -> [Stat]
|
||||
|
@ -492,6 +502,10 @@ reposizes_stats = stat desc $ nojson $ do
|
|||
}
|
||||
lpad n s = (replicate (n - length s) ' ') ++ s
|
||||
|
||||
reposizes_total :: Stat
|
||||
reposizes_total = simpleStat "combined size of repositories containing these files" $
|
||||
showSizeKeys . mconcat . M.elems =<< cachedRepoData
|
||||
|
||||
cachedPresentData :: StatState KeyData
|
||||
cachedPresentData = do
|
||||
s <- get
|
||||
|
|
Loading…
Reference in a new issue