changeset 39051:2aebe138ef6e

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
author Augie Fackler <augie@google.com>
date Fri, 10 Aug 2018 01:41:31 -0400
parents 0a2ce5b43574
children 38409be2f521
files mercurial/utils/stringutil.py
diffstat 1 files changed, 3 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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: