Show More
@@ -35,9 +35,8 b' class gitlfspointer(dict):' | |||
|
35 | 35 | try: |
|
36 | 36 | return cls(l.split(' ', 1) for l in text.splitlines()).validate() |
|
37 | 37 | except ValueError: # l.split returns 1 item instead of 2 |
|
38 | raise InvalidPointer( | |
|
39 |
|
|
|
40 | text, bprefix=False)) | |
|
38 | raise InvalidPointer(_('cannot parse git-lfs text: %s') | |
|
39 | % stringutil.pprint(text)) | |
|
41 | 40 | |
|
42 | 41 | def serialize(self): |
|
43 | 42 | sortkeyfunc = lambda x: (x[0] != 'version', x) |
@@ -66,14 +65,14 b' class gitlfspointer(dict):' | |||
|
66 | 65 | for k, v in self.iteritems(): |
|
67 | 66 | if k in self._requiredre: |
|
68 | 67 | if not self._requiredre[k].match(v): |
|
69 |
raise InvalidPointer(_('unexpected value: %s=%s') |
|
|
70 |
k, stringutil.pprint(v |
|
|
68 | raise InvalidPointer(_('unexpected value: %s=%s') | |
|
69 | % (k, stringutil.pprint(v))) | |
|
71 | 70 | requiredcount += 1 |
|
72 | 71 | elif not self._keyre.match(k): |
|
73 | 72 | raise InvalidPointer(_('unexpected key: %s') % k) |
|
74 | 73 | if not self._valuere.match(v): |
|
75 |
raise InvalidPointer(_('unexpected value: %s=%s') |
|
|
76 |
k, stringutil.pprint(v |
|
|
74 | raise InvalidPointer(_('unexpected value: %s=%s') | |
|
75 | % (k, stringutil.pprint(v))) | |
|
77 | 76 | if len(self._requiredre) != requiredcount: |
|
78 | 77 | miss = sorted(set(self._requiredre.keys()).difference(self.keys())) |
|
79 | 78 | raise InvalidPointer(_('missed keys: %s') % ', '.join(miss)) |
@@ -3017,10 +3017,12 b' def debugwireproto(ui, repo, path=None, ' | |||
|
3017 | 3017 | |
|
3018 | 3018 | if isinstance(res, wireprotov2peer.commandresponse): |
|
3019 | 3019 | val = list(res.cborobjects()) |
|
3020 |
ui.status(_('response: %s\n') % |
|
|
3020 | ui.status(_('response: %s\n') % | |
|
3021 | stringutil.pprint(val, bprefix=True)) | |
|
3021 | 3022 | |
|
3022 | 3023 | else: |
|
3023 |
ui.status(_('response: %s\n') % |
|
|
3024 | ui.status(_('response: %s\n') % | |
|
3025 | stringutil.pprint(res, bprefix=True)) | |
|
3024 | 3026 | |
|
3025 | 3027 | elif action == 'batchbegin': |
|
3026 | 3028 | if batchedcommands is not None: |
@@ -3092,7 +3094,8 b' def debugwireproto(ui, repo, path=None, ' | |||
|
3092 | 3094 | continue |
|
3093 | 3095 | |
|
3094 | 3096 | if res.headers.get('Content-Type') == 'application/mercurial-cbor': |
|
3095 |
ui.write(_('cbor> %s\n') % |
|
|
3097 | ui.write(_('cbor> %s\n') % | |
|
3098 | stringutil.pprint(cbor.loads(body), bprefix=True)) | |
|
3096 | 3099 | |
|
3097 | 3100 | elif action == 'close': |
|
3098 | 3101 | peer.close() |
@@ -138,7 +138,7 b' def _exthook(ui, repo, htype, name, cmd,' | |||
|
138 | 138 | if callable(v): |
|
139 | 139 | v = v() |
|
140 | 140 | if isinstance(v, (dict, list)): |
|
141 |
v = stringutil.pprint(v |
|
|
141 | v = stringutil.pprint(v) | |
|
142 | 142 | env['HG_' + k.upper()] = v |
|
143 | 143 | |
|
144 | 144 | if repo: |
@@ -106,8 +106,7 b' class status(tuple):' | |||
|
106 | 106 | def __repr__(self, *args, **kwargs): |
|
107 | 107 | return ((r'<status modified=%s, added=%s, removed=%s, deleted=%s, ' |
|
108 | 108 | r'unknown=%s, ignored=%s, clean=%s>') % |
|
109 | tuple(pycompat.sysstr(stringutil.pprint( | |
|
110 | v, bprefix=False)) for v in self)) | |
|
109 | tuple(pycompat.sysstr(stringutil.pprint(v)) for v in self)) | |
|
111 | 110 | |
|
112 | 111 | def itersubrepos(ctx1, ctx2): |
|
113 | 112 | """find subrepos in ctx1 or ctx2""" |
@@ -23,7 +23,7 b' from .. import (' | |||
|
23 | 23 | pycompat, |
|
24 | 24 | ) |
|
25 | 25 | |
|
26 |
def pprint(o, bprefix= |
|
|
26 | def pprint(o, bprefix=False): | |
|
27 | 27 | """Pretty print an object.""" |
|
28 | 28 | if isinstance(o, bytes): |
|
29 | 29 | if bprefix: |
@@ -28,7 +28,7 b' def writeauth(items):' | |||
|
28 | 28 | return ui |
|
29 | 29 | |
|
30 | 30 | def test(auth, urls=None): |
|
31 | print('CFG:', pycompat.sysstr(stringutil.pprint(auth))) | |
|
31 | print('CFG:', pycompat.sysstr(stringutil.pprint(auth, bprefix=True))) | |
|
32 | 32 | prefixes = set() |
|
33 | 33 | for k in auth: |
|
34 | 34 | prefixes.add(k.split('.', 1)[0]) |
@@ -18,7 +18,7 b' def debugformat(text, form, **kwargs):' | |||
|
18 | 18 | if type(out) == tuple: |
|
19 | 19 | print(out[0][:-1].decode('utf8')) |
|
20 | 20 | print("-" * 70) |
|
21 |
print(stringutil.pprint(out[1] |
|
|
21 | print(stringutil.pprint(out[1]).decode('utf8')) | |
|
22 | 22 | else: |
|
23 | 23 | print(out[:-1].decode('utf8')) |
|
24 | 24 | print("-" * 70) |
@@ -15,7 +15,7 b' testui.pushbuffer()' | |||
|
15 | 15 | testui.write((b'buffered\n')) |
|
16 | 16 | testui.warn((b'warning\n')) |
|
17 | 17 | testui.write_err(b'error\n') |
|
18 | print(stringutil.pprint(testui.popbuffer()).decode('ascii')) | |
|
18 | print(stringutil.pprint(testui.popbuffer(), bprefix=True).decode('ascii')) | |
|
19 | 19 | |
|
20 | 20 | # test dispatch.dispatch with the same ui object |
|
21 | 21 | hgrc = open(os.environ["HGRCPATH"], 'wb') |
@@ -51,7 +51,7 b' parsed = dispatch._parseconfig(testui, [' | |||
|
51 | 51 | ]) |
|
52 | 52 | |
|
53 | 53 | def pprint(obj): |
|
54 |
return stringutil.pprint(obj |
|
|
54 | return stringutil.pprint(obj).decode('ascii') | |
|
55 | 55 | |
|
56 | 56 | print(pprint(testui.configitems(b'values'))) |
|
57 | 57 | print(pprint(testui.configitems(b'lists'))) |
@@ -108,4 +108,5 b' with clt.commandexecutor() as e:' | |||
|
108 | 108 | fgreet1 = e.callcommand(b'greet', {b'name': b'Fo, =;:<o'}) |
|
109 | 109 | fgreet2 = e.callcommand(b'greet', {b'name': b'Bar'}) |
|
110 | 110 | |
|
111 |
printb(stringutil.pprint([f.result() for f in (fgreet1, fgreet2)] |
|
|
111 | printb(stringutil.pprint([f.result() for f in (fgreet1, fgreet2)], | |
|
112 | bprefix=True)) |
General Comments 0
You need to be logged in to leave comments.
Login now