mercurial/pycompat.py
changeset 35903 1a31111e6239
parent 35405 e66d6e938d2d
child 35904 fc44c2657dc5
--- a/mercurial/pycompat.py	Sat Jan 27 17:13:51 2018 +0900
+++ b/mercurial/pycompat.py	Sat Jan 27 17:31:25 2018 +0900
@@ -88,7 +88,7 @@
         """A bytes which mostly acts as a Python 2 str
 
         >>> bytestr(), bytestr(bytearray(b'foo')), bytestr(u'ascii'), bytestr(1)
-        (b'', b'foo', b'ascii', b'1')
+        ('', 'foo', 'ascii', '1')
         >>> s = bytestr(b'foo')
         >>> assert s is bytestr(s)
 
@@ -98,7 +98,7 @@
         ...     def __bytes__(self):
         ...         return b'bytes'
         >>> bytestr(bytesable())
-        b'bytes'
+        'bytes'
 
         There's no implicit conversion from non-ascii str as its encoding is
         unknown:
@@ -154,6 +154,9 @@
         def __iter__(self):
             return iterbytestr(bytes.__iter__(self))
 
+        def __repr__(self):
+            return bytes.__repr__(self)[1:]  # drop b''
+
     def iterbytestr(s):
         """Iterate bytes as if it were a str object of Python 2"""
         return map(bytechr, s)