This is an archive of the discontinued Mercurial Phabricator instance.

stringutil: teach pprint() to indent
ClosedPublic

Authored by indygreg on Aug 27 2018, 12:15 PM.

Details

Summary

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.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

indygreg created this revision.Aug 27 2018, 12:15 PM
martinvonz accepted this revision.Aug 30 2018, 6:40 PM
martinvonz added a subscriber: martinvonz.

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.

I agree :)

This revision is now accepted and ready to land.Aug 30 2018, 6:40 PM
This revision was automatically updated to reflect the committed changes.