summaryrefslogtreecommitdiff
path: root/Command/Status.hs
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2011-10-29 19:03:43 -0400
committerGravatar Joey Hess <joey@kitenet.net>2011-10-29 19:06:49 -0400
commitc102e63595d502c2424552b29e338ab71cb4a098 (patch)
tree98a266a8f0c12863fc323dc5e55fbeebd5e35275 /Command/Status.hs
parent61000904d74ffd4745dd6808bcfa88289affc169 (diff)
status: clean up for bare repositories
The backend usage graph shows present keys as well as keys found in the repository tree, so it will also be populated for bare repositories. Changed wording to "visible annex keys", which explains why it's 0 in a bare repository (no keys visible as no tree), and also why it varies depending on which branch is checked out. This seemed better than doing something expensive to look up keys from the git-annex branch.
Diffstat (limited to 'Command/Status.hs')
-rw-r--r--Command/Status.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/Command/Status.hs b/Command/Status.hs
index b5f4956db..53d64d042 100644
--- a/Command/Status.hs
+++ b/Command/Status.hs
@@ -57,8 +57,8 @@ stats =
, bad_data_size
, local_annex_keys
, local_annex_size
- , total_annex_keys
- , total_annex_size
+ , visible_annex_keys
+ , visible_annex_size
, backend_usage
]
@@ -99,16 +99,16 @@ local_annex_size :: Stat
local_annex_size = stat "local annex size" $
keySizeSum <$> cachedKeysPresent
-total_annex_size :: Stat
-total_annex_size = stat "total annex size" $
- keySizeSum <$> cachedKeysReferenced
-
local_annex_keys :: Stat
local_annex_keys = stat "local annex keys" $
show . S.size <$> cachedKeysPresent
-total_annex_keys :: Stat
-total_annex_keys = stat "total annex keys" $
+visible_annex_size :: Stat
+visible_annex_size = stat "visible annex size" $
+ keySizeSum <$> cachedKeysReferenced
+
+visible_annex_keys :: Stat
+visible_annex_keys = stat "visible annex keys" $
show . S.size <$> cachedKeysReferenced
tmp_size :: Stat
@@ -118,9 +118,9 @@ bad_data_size :: Stat
bad_data_size = staleSize "bad keys size" gitAnnexBadDir
backend_usage :: Stat
-backend_usage = stat "backend usage" $ usage <$> cachedKeysReferenced
+backend_usage = stat "backend usage" $ usage <$> cachedKeysReferenced <*> cachedKeysPresent
where
- usage ks = pp "" $ reverse . sort $ map swap $ splits $ S.toList ks
+ usage a b = pp "" $ reverse . sort $ map swap $ splits $ S.toList $ S.union a b
splits :: [Key] -> [(String, Integer)]
splits ks = M.toList $ M.fromListWith (+) $ map tcount ks
tcount k = (keyBackendName k, 1)