diff --git a/hgext/lfs/pointer.py b/hgext/lfs/pointer.py --- a/hgext/lfs/pointer.py +++ b/hgext/lfs/pointer.py @@ -35,9 +35,8 @@ class gitlfspointer(dict): try: return cls(l.split(' ', 1) for l in text.splitlines()).validate() except ValueError: # l.split returns 1 item instead of 2 - raise InvalidPointer( - _('cannot parse git-lfs text: %s') % stringutil.pprint( - text, bprefix=False)) + raise InvalidPointer(_('cannot parse git-lfs text: %s') + % stringutil.pprint(text)) def serialize(self): sortkeyfunc = lambda x: (x[0] != 'version', x) @@ -66,14 +65,14 @@ class gitlfspointer(dict): for k, v in self.iteritems(): if k in self._requiredre: if not self._requiredre[k].match(v): - raise InvalidPointer(_('unexpected value: %s=%s') % ( - k, stringutil.pprint(v, bprefix=False))) + raise InvalidPointer(_('unexpected value: %s=%s') + % (k, stringutil.pprint(v))) requiredcount += 1 elif not self._keyre.match(k): raise InvalidPointer(_('unexpected key: %s') % k) if not self._valuere.match(v): - raise InvalidPointer(_('unexpected value: %s=%s') % ( - k, stringutil.pprint(v, bprefix=False))) + raise InvalidPointer(_('unexpected value: %s=%s') + % (k, stringutil.pprint(v))) if len(self._requiredre) != requiredcount: miss = sorted(set(self._requiredre.keys()).difference(self.keys())) raise InvalidPointer(_('missed keys: %s') % ', '.join(miss)) diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -3017,10 +3017,12 @@ def debugwireproto(ui, repo, path=None, if isinstance(res, wireprotov2peer.commandresponse): val = list(res.cborobjects()) - ui.status(_('response: %s\n') % stringutil.pprint(val)) + ui.status(_('response: %s\n') % + stringutil.pprint(val, bprefix=True)) else: - ui.status(_('response: %s\n') % stringutil.pprint(res)) + ui.status(_('response: %s\n') % + stringutil.pprint(res, bprefix=True)) elif action == 'batchbegin': if batchedcommands is not None: @@ -3092,7 +3094,8 @@ def debugwireproto(ui, repo, path=None, continue if res.headers.get('Content-Type') == 'application/mercurial-cbor': - ui.write(_('cbor> %s\n') % stringutil.pprint(cbor.loads(body))) + ui.write(_('cbor> %s\n') % + stringutil.pprint(cbor.loads(body), bprefix=True)) elif action == 'close': peer.close() diff --git a/mercurial/hook.py b/mercurial/hook.py --- a/mercurial/hook.py +++ b/mercurial/hook.py @@ -138,7 +138,7 @@ def _exthook(ui, repo, htype, name, cmd, if callable(v): v = v() if isinstance(v, (dict, list)): - v = stringutil.pprint(v, bprefix=False) + v = stringutil.pprint(v) env['HG_' + k.upper()] = v if repo: diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -106,8 +106,7 @@ class status(tuple): def __repr__(self, *args, **kwargs): return ((r'') % - tuple(pycompat.sysstr(stringutil.pprint( - v, bprefix=False)) for v in self)) + tuple(pycompat.sysstr(stringutil.pprint(v)) for v in self)) def itersubrepos(ctx1, ctx2): """find subrepos in ctx1 or ctx2""" diff --git a/mercurial/utils/stringutil.py b/mercurial/utils/stringutil.py --- a/mercurial/utils/stringutil.py +++ b/mercurial/utils/stringutil.py @@ -23,7 +23,7 @@ from .. import ( pycompat, ) -def pprint(o, bprefix=True): +def pprint(o, bprefix=False): """Pretty print an object.""" if isinstance(o, bytes): if bprefix: diff --git a/tests/test-hgweb-auth.py b/tests/test-hgweb-auth.py --- a/tests/test-hgweb-auth.py +++ b/tests/test-hgweb-auth.py @@ -28,7 +28,7 @@ def writeauth(items): return ui def test(auth, urls=None): - print('CFG:', pycompat.sysstr(stringutil.pprint(auth))) + print('CFG:', pycompat.sysstr(stringutil.pprint(auth, bprefix=True))) prefixes = set() for k in auth: prefixes.add(k.split('.', 1)[0]) diff --git a/tests/test-minirst.py b/tests/test-minirst.py --- a/tests/test-minirst.py +++ b/tests/test-minirst.py @@ -18,7 +18,7 @@ def debugformat(text, form, **kwargs): if type(out) == tuple: print(out[0][:-1].decode('utf8')) print("-" * 70) - print(stringutil.pprint(out[1], bprefix=False).decode('utf8')) + print(stringutil.pprint(out[1]).decode('utf8')) else: print(out[:-1].decode('utf8')) print("-" * 70) diff --git a/tests/test-ui-color.py b/tests/test-ui-color.py --- a/tests/test-ui-color.py +++ b/tests/test-ui-color.py @@ -15,7 +15,7 @@ testui.pushbuffer() testui.write((b'buffered\n')) testui.warn((b'warning\n')) testui.write_err(b'error\n') -print(stringutil.pprint(testui.popbuffer()).decode('ascii')) +print(stringutil.pprint(testui.popbuffer(), bprefix=True).decode('ascii')) # test dispatch.dispatch with the same ui object hgrc = open(os.environ["HGRCPATH"], 'wb') diff --git a/tests/test-ui-config.py b/tests/test-ui-config.py --- a/tests/test-ui-config.py +++ b/tests/test-ui-config.py @@ -51,7 +51,7 @@ parsed = dispatch._parseconfig(testui, [ ]) def pprint(obj): - return stringutil.pprint(obj, bprefix=False).decode('ascii') + return stringutil.pprint(obj).decode('ascii') print(pprint(testui.configitems(b'values'))) print(pprint(testui.configitems(b'lists'))) diff --git a/tests/test-wireproto.py b/tests/test-wireproto.py --- a/tests/test-wireproto.py +++ b/tests/test-wireproto.py @@ -108,4 +108,5 @@ with clt.commandexecutor() as e: fgreet1 = e.callcommand(b'greet', {b'name': b'Fo, =;: