# HG changeset patch # User Augie Fackler # Date 2018-08-10 05:41:31 # Node ID 2aebe138ef6eeb6644792d4ac55976ea2d16229b # Parent 0a2ce5b435744ed93dd9535b40464e3c75231433 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 diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -59,6 +59,9 @@ def pprint(o, bprefix=False): '%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: