stringutil: teach pprint() to indent
This will make data structure dumping in various places a bit easier to read and diff. Since I wanted this for `hg debugwireproto` output, I added indentation to it. A more advanced pretty printer implementation would conditionally add newlines if output is too long. But it is vastly simpler to be consistent and always add newlines when indenting. Again, I'm not crazy about the verbosity of the code and there is room to consolidate logic for "print a collection." But this isn't the most complicated code in the world and I'm not convinced it is worth doing. Differential Revision: https://phab.mercurial-scm.org/D4399
Showing
- mercurial/debugcommands.py 4 additions, 4 deletionsmercurial/debugcommands.py
- mercurial/utils/stringutil.py 89 additions, 15 deletionsmercurial/utils/stringutil.py
- tests/test-http-api-httpv2.t 6 additions, 1 deletiontests/test-http-api-httpv2.t
- tests/test-http-protocol.t 17 additions, 5 deletionstests/test-http-protocol.t
- tests/test-ssh-proto.t 54 additions, 14 deletionstests/test-ssh-proto.t
- tests/test-wireproto-command-branchmap.t 12 additions, 1 deletiontests/test-wireproto-command-branchmap.t
- tests/test-wireproto-command-capabilities.t 167 additions, 4 deletionstests/test-wireproto-command-capabilities.t
- tests/test-wireproto-command-heads.t 8 additions, 2 deletionstests/test-wireproto-command-heads.t
- tests/test-wireproto-command-known.t 8 additions, 2 deletionstests/test-wireproto-command-known.t
- tests/test-wireproto-command-listkeys.t 12 additions, 3 deletionstests/test-wireproto-command-listkeys.t
- tests/test-wireproto-command-pushkey.t 3 additions, 1 deletiontests/test-wireproto-command-pushkey.t
Loading
Please register or sign in to comment