From 6cb5b7294f526ba615f9aa6b1e67241f7aade7f6 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 5 Apr 2018 14:54:39 -0400 Subject: [PATCH] info: Changed sorting of numcopies stats table, so it's ordered by the variance from the desired number of copies. Compare these... numcopies stats: numcopies -1: 1986 numcopies +0: 1170 numcopies -2: 769 numcopies +1: 716 numcopies -4: 696 numcopies -3: 485 numcopies -6: 230 numcopies -5: 111 numcopies -7: 91 numcopies -9: 9 numcopies stats: numcopies +1: 716 numcopies +0: 1170 numcopies -1: 1986 numcopies -2: 769 numcopies -3: 485 numcopies -4: 696 numcopies -5: 111 numcopies -6: 230 numcopies -7: 91 numcopies -9: 9 I feel that the former is a jumbled mess that doesn't tell much overall, while the second shows pretty clearly that most files are within 1 degree of the desired number of copies, with some outliers without enough. --- CHANGELOG | 2 ++ Command/Info.hs | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 004bf899a6..70e31110a2 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -16,6 +16,8 @@ git-annex (6.20180317) UNRELEASED; urgency=medium uses http-conduit. * info: Added "combined size of repositories containing these files" stat when run on a directory. + * info: Changed sorting of numcopies stats table, so it's ordered + by the variance from the desired number of copies. -- Joey Hess Mon, 19 Mar 2018 23:13:59 -0400 diff --git a/Command/Info.hs b/Command/Info.hs index 54e067a80b..6ec6a1f71e 100644 --- a/Command/Info.hs +++ b/Command/Info.hs @@ -477,7 +477,7 @@ numcopies_stats = stat "numcopies stats" $ json fmt $ calc <$> (maybe M.empty numCopiesVarianceMap <$> cachedNumCopiesStats) where calc = map (\(variance, count) -> (show variance, count)) - . sortBy (flip (comparing snd)) + . sortBy (flip (comparing fst)) . M.toList fmt = multiLine . map (\(variance, count) -> "numcopies " ++ variance ++ ": " ++ show count)