D4243: stringutil: teach pprint about sets
durin42 (Augie Fackler)
phabricator at mercurial-scm.org
Fri Aug 10 05:53:03 UTC 2018
durin42 created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D4243
AFFECTED FILES
mercurial/utils/stringutil.py
CHANGE DETAILS
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 @@
'%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:
To: durin42, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list