Patchwork [4,of,4] formatter: make debug output prettier

login
register
mail settings
Submitter Yuya Nishihara
Date Oct. 14, 2018, 6:21 a.m.
Message ID <6ab52e3afcb677826142.1539498100@mimosa>
Download mbox | patch
Permalink /patch/35949/
State Accepted
Headers show

Comments

Yuya Nishihara - Oct. 14, 2018, 6:21 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@tcha.org>
# Date 1539494701 -7200
#      Sun Oct 14 07:25:01 2018 +0200
# Node ID 6ab52e3afcb67782614218102cb12e59e56acb49
# Parent  f162af4aacd5c3483b333128496df234118902e3
formatter: make debug output prettier

"(glob)" won't be needed since pprintgen() can print dict items in stable
order.

Patch

diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -324,7 +324,8 @@  class debugformatter(baseformatter):
         self._out = out
         self._out.write("%s = [\n" % self._topic)
     def _showitem(self):
-        self._out.write('    %s,\n' % stringutil.pprint(self._item))
+        self._out.write('    %s,\n'
+                        % stringutil.pprint(self._item, indent=4, level=1))
     def end(self):
         baseformatter.end(self)
         self._out.write("]\n")
diff --git a/tests/test-status.t b/tests/test-status.t
--- a/tests/test-status.t
+++ b/tests/test-status.t
@@ -528,7 +528,10 @@  warning message about such pattern.
 
   $ hg status --config ui.formatdebug=True --rev 1 1
   status = [
-      {*'path': '1/2/3/4/5/b.txt'*}, (glob)
+      {
+          'path': '1/2/3/4/5/b.txt',
+          'status': 'R'
+      },
   ]
 
 #if windows