summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2016-01-01 16:33:05 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2016-01-01 16:33:05 -0400
commit6bfb6df8f614da248562b932217566731892681d (patch)
tree3173bce3970137092042fc5ef6d4b02d63f01843
parent3732d4a2673cbe5e7b4c39b7fa2c211da0689d84 (diff)
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.
-rw-r--r--Command/Info.hs5
-rw-r--r--debian/changelog3
-rw-r--r--doc/bugs/info_--json_lists_backend_usage_stats_as_a_list_of_lists/comment_1_5db5f19d9bdc81839d984b7e302e49ed._comment23
3 files changed, 28 insertions, 3 deletions
diff --git a/Command/Info.hs b/Command/Info.hs
index 763279612..cb55602a6 100644
--- a/Command/Info.hs
+++ b/Command/Info.hs
@@ -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 $
diff --git a/debian/changelog b/debian/changelog
index 0563eba43..22db45245 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -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
diff --git a/doc/bugs/info_--json_lists_backend_usage_stats_as_a_list_of_lists/comment_1_5db5f19d9bdc81839d984b7e302e49ed._comment b/doc/bugs/info_--json_lists_backend_usage_stats_as_a_list_of_lists/comment_1_5db5f19d9bdc81839d984b7e302e49ed._comment
new file mode 100644
index 000000000..81a999e20
--- /dev/null
+++ b/doc/bugs/info_--json_lists_backend_usage_stats_as_a_list_of_lists/comment_1_5db5f19d9bdc81839d984b7e302e49ed._comment
@@ -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.
+"""]]