Show More
@@ -70,7 +70,6 b' from . import (' | |||
|
70 | 70 | scmutil, |
|
71 | 71 | setdiscovery, |
|
72 | 72 | simplemerge, |
|
73 | smartset, | |
|
74 | 73 | sshpeer, |
|
75 | 74 | sslutil, |
|
76 | 75 | streamclone, |
@@ -2236,8 +2235,8 b' def debugrevspec(ui, repo, expr, **opts)' | |||
|
2236 | 2235 | arevs = revset.makematcher(treebystage['analyzed'])(repo) |
|
2237 | 2236 | brevs = revset.makematcher(treebystage['optimized'])(repo) |
|
2238 | 2237 | if opts['show_set'] or (opts['show_set'] is None and ui.verbose): |
|
2239 |
ui.write(("* analyzed set:\n"), s |
|
|
2240 |
ui.write(("* optimized set:\n"), s |
|
|
2238 | ui.write(("* analyzed set:\n"), stringutil.prettyrepr(arevs), "\n") | |
|
2239 | ui.write(("* optimized set:\n"), stringutil.prettyrepr(brevs), "\n") | |
|
2241 | 2240 | arevs = list(arevs) |
|
2242 | 2241 | brevs = list(brevs) |
|
2243 | 2242 | if arevs == brevs: |
@@ -2260,7 +2259,7 b' def debugrevspec(ui, repo, expr, **opts)' | |||
|
2260 | 2259 | func = revset.makematcher(tree) |
|
2261 | 2260 | revs = func(repo) |
|
2262 | 2261 | if opts['show_set'] or (opts['show_set'] is None and ui.verbose): |
|
2263 |
ui.write(("* set:\n"), s |
|
|
2262 | ui.write(("* set:\n"), stringutil.prettyrepr(revs), "\n") | |
|
2264 | 2263 | if not opts['show_revs']: |
|
2265 | 2264 | return |
|
2266 | 2265 | for c in revs: |
@@ -1129,17 +1129,3 b' class fullreposet(_spanset):' | |||
|
1129 | 1129 | |
|
1130 | 1130 | other.sort(reverse=self.isdescending()) |
|
1131 | 1131 | return other |
|
1132 | ||
|
1133 | def prettyformat(revs): | |
|
1134 | lines = [] | |
|
1135 | rs = pycompat.byterepr(revs) | |
|
1136 | p = 0 | |
|
1137 | while p < len(rs): | |
|
1138 | q = rs.find('<', p + 1) | |
|
1139 | if q < 0: | |
|
1140 | q = len(rs) | |
|
1141 | l = rs.count('<', 0, p) - rs.count('>', 0, p) | |
|
1142 | assert l >= 0 | |
|
1143 | lines.append((l, rs[p:q].rstrip())) | |
|
1144 | p = q | |
|
1145 | return '\n'.join(' ' * l + s for l, s in lines) |
@@ -45,6 +45,21 b' def pprint(o, bprefix=False):' | |||
|
45 | 45 | else: |
|
46 | 46 | return pycompat.byterepr(o) |
|
47 | 47 | |
|
48 | def prettyrepr(o): | |
|
49 | """Pretty print a representation of a possibly-nested object""" | |
|
50 | lines = [] | |
|
51 | rs = pycompat.byterepr(o) | |
|
52 | p = 0 | |
|
53 | while p < len(rs): | |
|
54 | q = rs.find('<', p + 1) | |
|
55 | if q < 0: | |
|
56 | q = len(rs) | |
|
57 | l = rs.count('<', 0, p) - rs.count('>', 0, p) | |
|
58 | assert l >= 0 | |
|
59 | lines.append((l, rs[p:q].rstrip())) | |
|
60 | p = q | |
|
61 | return '\n'.join(' ' * l + s for l, s in lines) | |
|
62 | ||
|
48 | 63 | def binary(s): |
|
49 | 64 | """return true if a string is binary data""" |
|
50 | 65 | return bool(s and '\0' in s) |
@@ -91,6 +91,7 b' o (0) root' | |||
|
91 | 91 | > revsetlang, |
|
92 | 92 | > smartset, |
|
93 | 93 | > ) |
|
94 | > from mercurial.utils import stringutil | |
|
94 | 95 | > |
|
95 | 96 | > def logrevset(repo, pats, opts): |
|
96 | 97 | > revs = logcmdutil._initialrevs(repo, opts) |
@@ -112,7 +113,7 b' o (0) root' | |||
|
112 | 113 | > ui = repo.ui |
|
113 | 114 | > ui.write(b'%r\n' % (opts.get(b'rev', []),)) |
|
114 | 115 | > ui.write(revsetlang.prettyformat(tree) + b'\n') |
|
115 |
> ui.write(s |
|
|
116 | > ui.write(stringutil.prettyrepr(revs) + b'\n') | |
|
116 | 117 | > revs = smartset.baseset() # display no revisions |
|
117 | 118 | > return revs, filematcher |
|
118 | 119 | > extensions.wrapfunction(logcmdutil, 'getrevs', printrevset) |
@@ -42,8 +42,8 b" these predicates use '\\0' as a separator" | |||
|
42 | 42 | > registrar, |
|
43 | 43 | > revset, |
|
44 | 44 | > revsetlang, |
|
45 | > smartset, | |
|
46 | 45 | > ) |
|
46 | > from mercurial.utils import stringutil | |
|
47 | 47 | > cmdtable = {} |
|
48 | 48 | > command = registrar.command(cmdtable) |
|
49 | 49 | > @command(b'debugrevlistspec', |
@@ -63,7 +63,7 b" these predicates use '\\0' as a separator" | |||
|
63 | 63 | > func = revset.match(ui, expr, lookup=revset.lookupfn(repo)) |
|
64 | 64 | > revs = func(repo) |
|
65 | 65 | > if ui.verbose: |
|
66 |
> ui.note(b"* set:\n", s |
|
|
66 | > ui.note(b"* set:\n", stringutil.prettyrepr(revs), b"\n") | |
|
67 | 67 | > for c in revs: |
|
68 | 68 | > ui.write(b"%d\n" % c) |
|
69 | 69 | > EOF |
General Comments 0
You need to be logged in to leave comments.
Login now