Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/utils/stringutil.py @ 39089:38409be2f521
stringutil: have buildrepr delegate to pprint for unknown types
This stabilizes some revset reprs across Python 2 and 3.
Differential Revision: https://phab.mercurial-scm.org/D4244
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 10 Aug 2018 01:42:01 -0400 |
parents | 2aebe138ef6e |
children | 1419ba5e3b56 |
comparison
equal
deleted
inserted
replaced
39088:2aebe138ef6e | 39089:38409be2f521 |
---|---|
112 elif isinstance(r, bytes): | 112 elif isinstance(r, bytes): |
113 return r | 113 return r |
114 elif callable(r): | 114 elif callable(r): |
115 return r() | 115 return r() |
116 else: | 116 else: |
117 return pycompat.byterepr(r) | 117 return pprint(r) |
118 | 118 |
119 def binary(s): | 119 def binary(s): |
120 """return true if a string is binary data""" | 120 """return true if a string is binary data""" |
121 return bool(s and '\0' in s) | 121 return bool(s and '\0' in s) |
122 | 122 |