stringutil: teach pprint about sets
authorAugie Fackler <augie@google.com>
Fri, 10 Aug 2018 01:41:31 -0400
changeset 39051 2aebe138ef6e
parent 39050 0a2ce5b43574
child 39052 38409be2f521
stringutil: teach pprint about sets This is the old (Python 2) way of printing sets. I actually prefer the Python 3 version of the repr, but this will result in less test churn in the short term. Differential Revision: https://phab.mercurial-scm.org/D4243
mercurial/utils/stringutil.py
--- a/mercurial/utils/stringutil.py	Fri Aug 10 00:12:55 2018 -0400
+++ b/mercurial/utils/stringutil.py	Fri Aug 10 01:41:31 2018 -0400
@@ -59,6 +59,9 @@
             '%s: %s' % (pprint(k, bprefix=bprefix),
                         pprint(v, bprefix=bprefix))
             for k, v in sorted(o.items())))
+    elif isinstance(o, set):
+        return 'set([%s])' % (b', '.join(
+            pprint(k, bprefix=bprefix) for k in sorted(o)))
     elif isinstance(o, tuple):
         return '(%s)' % (b', '.join(pprint(a, bprefix=bprefix) for a in o))
     else: