changeset 35386:c0b6fa74e007

debugformat: flush formatter output per item
author Yuya Nishihara <yuya@tcha.org>
date Sun, 10 Dec 2017 19:39:39 +0900
parents c7d49b87c1ee
children 9144e898cad5
files mercurial/debugcommands.py tests/test-upgrade-repo.t
diffstat 2 files changed, 35 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sat Dec 09 19:42:51 2017 -0600
+++ b/mercurial/debugcommands.py	Sun Dec 10 19:39:39 2017 +0900
@@ -888,8 +888,8 @@
     if ui.verbose:
         fm.plain(' config default')
     fm.plain('\n')
-    fm.startitem()
     for fv in upgrade.allformatvariant:
+        fm.startitem()
         repovalue = fv.fromrepo(repo)
         configvalue = fv.fromconfig(repo)
 
@@ -916,6 +916,7 @@
         fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
                      label='formatvariant.default')
         fm.plain('\n')
+    fm.end()
 
 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
 def debugfsinfo(ui, path="."):
--- a/tests/test-upgrade-repo.t	Sat Dec 09 19:42:51 2017 -0600
+++ b/tests/test-upgrade-repo.t	Sun Dec 10 19:39:39 2017 +0900
@@ -82,6 +82,39 @@
   [formatvariant.name.uptodate|generaldelta:  ][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
   [formatvariant.name.uptodate|plain-cl-delta:][formatvariant.repo.uptodate| yes][formatvariant.config.default|    yes][formatvariant.default|     yes]
   [formatvariant.name.uptodate|compression:   ][formatvariant.repo.uptodate| zlib][formatvariant.config.default|   zlib][formatvariant.default|    zlib]
+  $ hg debugformat -Tjson
+  [
+   {
+    "config": "yes",
+    "default": "yes",
+    "name": "fncache",
+    "repo": "yes"
+   },
+   {
+    "config": "yes",
+    "default": "yes",
+    "name": "dotencode",
+    "repo": "yes"
+   },
+   {
+    "config": "yes",
+    "default": "yes",
+    "name": "generaldelta",
+    "repo": "yes"
+   },
+   {
+    "config": "yes",
+    "default": "yes",
+    "name": "plain-cl-delta",
+    "repo": "yes"
+   },
+   {
+    "config": "zlib",
+    "default": "zlib",
+    "name": "compression",
+    "repo": "zlib"
+   }
+  ]
   $ hg debugupgraderepo
   (no feature deficiencies found in existing repository)
   performing an upgrade with "--run" will make the following changes: