diff --git a/mercurial/encoding.py b/mercurial/encoding.py --- a/mercurial/encoding.py +++ b/mercurial/encoding.py @@ -247,6 +247,7 @@ def trim(s, width, ellipsis='', leftside If 'leftside' is True, left side of string 's' is trimmed. 'ellipsis' is always placed at trimmed side. + >>> from .node import bin >>> ellipsis = b'+++' >>> from . import encoding >>> encoding.encoding = b'utf-8' @@ -285,7 +286,7 @@ def trim(s, width, ellipsis='', leftside +++ >>> print trim(t, 4, ellipsis=ellipsis, leftside=True) +++ - >>> t = b'\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa' # invalid byte sequence + >>> t = bin(b'112233445566778899aa') # invalid byte sequence >>> print trim(t, 12, ellipsis=ellipsis) \x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa >>> print trim(t, 10, ellipsis=ellipsis) diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -95,7 +95,7 @@ def _buildencodefun(): >>> dec(b'hello~3aworld~3f') 'hello:world?' - >>> enc(b'the\x07quick\xADshot') + >>> enc(b'the\\x07quick\\xADshot') 'the~07quick~adshot' >>> dec(b'the~07quick~adshot') 'the\\x07quick\\xadshot' @@ -154,7 +154,7 @@ def _buildlowerencodefun(): 'hello' >>> f(b'hello:world?') 'hello~3aworld~3f' - >>> f(b'the\x07quick\xADshot') + >>> f(b'the\\x07quick\\xADshot') 'the~07quick~adshot' ''' cmap = dict([(chr(x), chr(x)) for x in xrange(127)])