info --json: Improve json for "backend usage", using a nested object with fields for each backend instead of the previous weird nested lists. This may break existing parsers of this json output, if there were any.
This commit is contained in:
parent
09a2fcb643
commit
121659576b
3 changed files with 28 additions and 3 deletions
|
@ -12,7 +12,6 @@ module Command.Info where
|
|||
import "mtl" Control.Monad.State.Strict
|
||||
import qualified Data.Map.Strict as M
|
||||
import Text.JSON
|
||||
import Data.Tuple
|
||||
import Data.Ord
|
||||
|
||||
import Common.Annex
|
||||
|
@ -403,9 +402,9 @@ disk_size = simpleStat "available local disk space" $
|
|||
|
||||
backend_usage :: Stat
|
||||
backend_usage = stat "backend usage" $ json fmt $
|
||||
sort . M.toList . backendsKeys <$> cachedReferencedData
|
||||
toJSObject . sort . M.toList . backendsKeys <$> cachedReferencedData
|
||||
where
|
||||
fmt = multiLine . map (\(n, b) -> b ++ ": " ++ show n) . map swap
|
||||
fmt = multiLine . map (\(b, n) -> b ++ ": " ++ show n) . fromJSObject
|
||||
|
||||
numcopies_stats :: Stat
|
||||
numcopies_stats = stat "numcopies stats" $ json fmt $
|
||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -35,6 +35,9 @@ git-annex (6.20151219) UNRELEASED; urgency=medium
|
|||
there.
|
||||
* info: Fix "backend usage" numbers, which were counting present keys
|
||||
twice.
|
||||
* info --json: Improve json for "backend usage", using a nested object
|
||||
with fields for each backend instead of the previous weird nested lists.
|
||||
This may break existing parsers of this json output, if there were any.
|
||||
|
||||
-- Joey Hess <id@joeyh.name> Sat, 19 Dec 2015 13:31:17 -0400
|
||||
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
[[!comment format=mdwn
|
||||
username="joey"
|
||||
subject="""comment 1"""
|
||||
date="2016-01-01T20:27:27Z"
|
||||
content="""
|
||||
It was indeed a bug that it counted both keys referenced in the work tree
|
||||
and keys whose content was present. Fixed.
|
||||
|
||||
It's not hard to fix the json format, but then what happens to anything
|
||||
that may be parsing the existing format? I could use a different field
|
||||
for the better formatted version and keep the old version in the current
|
||||
field, but if the goal is to make the json better, that doesn't really
|
||||
work.
|
||||
|
||||
Since the old output is so funky, it seems likely to me you're the first
|
||||
one to try to consume it since anyone reasonable would file a but report
|
||||
about it and you're the first who did.
|
||||
|
||||
So.. I guess I'll change the json format and see if anyone complains.
|
||||
|
||||
I have to say that this business of not having any specification other
|
||||
than what it currently is, is what annoys me about JSON as a consumer of it.
|
||||
"""]]
|
Loading…
Add table
Reference in a new issue