##// END OF EJS Templates
py3: factor out byterepr() which returns an asciified value on py3
Yuya Nishihara -
r36279:b44fac3a default
parent child Browse files
Show More
@@ -291,7 +291,7 b' class debugformatter(baseformatter):'
291 291 self._out = out
292 292 self._out.write("%s = [\n" % self._topic)
293 293 def _showitem(self):
294 self._out.write(' %s,\n' % pycompat.sysbytes(repr(self._item)))
294 self._out.write(' %s,\n' % pycompat.byterepr(self._item))
295 295 def end(self):
296 296 baseformatter.end(self)
297 297 self._out.write("]\n")
@@ -85,6 +85,7 b' if ispy3:'
85 85 sysargv = list(map(os.fsencode, sys.argv))
86 86
87 87 bytechr = struct.Struct('>B').pack
88 byterepr = b'%r'.__mod__
88 89
89 90 class bytestr(bytes):
90 91 """A bytes which mostly acts as a Python 2 str
@@ -277,6 +278,7 b' else:'
277 278 import cStringIO
278 279
279 280 bytechr = chr
281 byterepr = repr
280 282 bytestr = str
281 283 iterbytestr = iter
282 284 maybebytestr = identity
@@ -35,7 +35,7 b' def _formatsetrepr(r):'
35 35 elif callable(r):
36 36 return r()
37 37 else:
38 return pycompat.sysbytes(repr(r))
38 return pycompat.byterepr(r)
39 39
40 40 def _typename(o):
41 41 return pycompat.sysbytes(type(o).__name__).lstrip('_')
@@ -400,7 +400,7 b' class baseset(abstractsmartset):'
400 400 # We fallback to the sorted version for a stable output.
401 401 if self._ascending is not None:
402 402 l = self._asclist
403 s = pycompat.sysbytes(repr(l))
403 s = pycompat.byterepr(l)
404 404 return '<%s%s %s>' % (_typename(self), d, s)
405 405
406 406 class filteredset(abstractsmartset):
@@ -513,7 +513,7 b' class filteredset(abstractsmartset):'
513 513
514 514 @encoding.strmethod
515 515 def __repr__(self):
516 xs = [pycompat.sysbytes(repr(self._subset))]
516 xs = [pycompat.byterepr(self._subset)]
517 517 s = _formatsetrepr(self._condrepr)
518 518 if s:
519 519 xs.append(s)
@@ -1132,7 +1132,7 b' class fullreposet(_spanset):'
1132 1132
1133 1133 def prettyformat(revs):
1134 1134 lines = []
1135 rs = pycompat.sysbytes(repr(revs))
1135 rs = pycompat.byterepr(revs)
1136 1136 p = 0
1137 1137 while p < len(rs):
1138 1138 q = rs.find('<', p + 1)
General Comments 0
You need to be logged in to leave comments. Login now