Show More
@@ -49,15 +49,26 b' def prettyrepr(o):' | |||||
49 | """Pretty print a representation of a possibly-nested object""" |
|
49 | """Pretty print a representation of a possibly-nested object""" | |
50 | lines = [] |
|
50 | lines = [] | |
51 | rs = pycompat.byterepr(o) |
|
51 | rs = pycompat.byterepr(o) | |
52 | p = 0 |
|
52 | p0 = p1 = 0 | |
53 | while p < len(rs): |
|
53 | while p0 < len(rs): | |
54 | q = rs.find('<', p + 1) |
|
54 | # '... field=<type ... field=<type ...' | |
55 | if q < 0: |
|
55 | # ~~~~~~~~~~~~~~~~ | |
56 | q = len(rs) |
|
56 | # p0 p1 q0 q1 | |
57 | l = rs.count('<', 0, p) - rs.count('>', 0, p) |
|
57 | q0 = -1 | |
|
58 | q1 = rs.find('<', p1 + 1) | |||
|
59 | if q1 < 0: | |||
|
60 | q1 = len(rs) | |||
|
61 | elif q1 > p1 + 1 and rs.startswith('=', q1 - 1): | |||
|
62 | # backtrack for ' field=<' | |||
|
63 | q0 = rs.rfind(' ', p1 + 1, q1 - 1) | |||
|
64 | if q0 < 0: | |||
|
65 | q0 = q1 | |||
|
66 | else: | |||
|
67 | q0 += 1 # skip ' ' | |||
|
68 | l = rs.count('<', 0, p0) - rs.count('>', 0, p0) | |||
58 | assert l >= 0 |
|
69 | assert l >= 0 | |
59 | lines.append((l, rs[p:q].rstrip())) |
|
70 | lines.append((l, rs[p0:q0].rstrip())) | |
60 | p = q |
|
71 | p0, p1 = q0, q1 | |
61 | return '\n'.join(' ' * l + s for l, s in lines) |
|
72 | return '\n'.join(' ' * l + s for l, s in lines) | |
62 |
|
73 | |||
63 | def binary(s): |
|
74 | def binary(s): |
@@ -80,9 +80,9 b'' | |||||
80 | f mammals/skunk skunk |
|
80 | f mammals/skunk skunk | |
81 | $ hg debugwalk -v -X ../beans |
|
81 | $ hg debugwalk -v -X ../beans | |
82 | * matcher: |
|
82 | * matcher: | |
83 |
<differencematcher |
|
83 | <differencematcher | |
84 |
<alwaysmatcher>, |
|
84 | m1=<alwaysmatcher>, | |
85 | <includematcher includes='(?:beans(?:/|$))'>> |
|
85 | m2=<includematcher includes='(?:beans(?:/|$))'>> | |
86 | f fennel ../fennel |
|
86 | f fennel ../fennel | |
87 | f fenugreek ../fenugreek |
|
87 | f fenugreek ../fenugreek | |
88 | f fiddlehead ../fiddlehead |
|
88 | f fiddlehead ../fiddlehead | |
@@ -106,9 +106,9 b'' | |||||
106 | f mammals/skunk skunk |
|
106 | f mammals/skunk skunk | |
107 | $ hg debugwalk -v -I 'relglob:*k' . |
|
107 | $ hg debugwalk -v -I 'relglob:*k' . | |
108 | * matcher: |
|
108 | * matcher: | |
109 |
<intersectionmatcher |
|
109 | <intersectionmatcher | |
110 |
<patternmatcher patterns='(?:mammals(?:/|$))'>, |
|
110 | m1=<patternmatcher patterns='(?:mammals(?:/|$))'>, | |
111 | <includematcher includes='(?:(?:|.*/)[^/]*k(?:/|$))'>> |
|
111 | m2=<includematcher includes='(?:(?:|.*/)[^/]*k(?:/|$))'>> | |
112 | f mammals/skunk skunk |
|
112 | f mammals/skunk skunk | |
113 | $ hg debugwalk -v -I 're:.*k$' |
|
113 | $ hg debugwalk -v -I 're:.*k$' | |
114 | * matcher: |
|
114 | * matcher: | |
@@ -167,9 +167,9 b'' | |||||
167 | f fiddlehead ../fiddlehead |
|
167 | f fiddlehead ../fiddlehead | |
168 | $ hg debugwalk -v -X 'rootfilesin:' |
|
168 | $ hg debugwalk -v -X 'rootfilesin:' | |
169 | * matcher: |
|
169 | * matcher: | |
170 |
<differencematcher |
|
170 | <differencematcher | |
171 |
<alwaysmatcher>, |
|
171 | m1=<alwaysmatcher>, | |
172 | <includematcher includes='(?:[^/]+$)'>> |
|
172 | m2=<includematcher includes='(?:[^/]+$)'>> | |
173 | f beans/black ../beans/black |
|
173 | f beans/black ../beans/black | |
174 | f beans/borlotti ../beans/borlotti |
|
174 | f beans/borlotti ../beans/borlotti | |
175 | f beans/kidney ../beans/kidney |
|
175 | f beans/kidney ../beans/kidney | |
@@ -228,9 +228,9 b'' | |||||
228 | f mammals/skunk skunk |
|
228 | f mammals/skunk skunk | |
229 | $ hg debugwalk -v -X 'rootfilesin:mammals' |
|
229 | $ hg debugwalk -v -X 'rootfilesin:mammals' | |
230 | * matcher: |
|
230 | * matcher: | |
231 |
<differencematcher |
|
231 | <differencematcher | |
232 |
<alwaysmatcher>, |
|
232 | m1=<alwaysmatcher>, | |
233 | <includematcher includes='(?:mammals/[^/]+$)'>> |
|
233 | m2=<includematcher includes='(?:mammals/[^/]+$)'>> | |
234 | f beans/black ../beans/black |
|
234 | f beans/black ../beans/black | |
235 | f beans/borlotti ../beans/borlotti |
|
235 | f beans/borlotti ../beans/borlotti | |
236 | f beans/kidney ../beans/kidney |
|
236 | f beans/kidney ../beans/kidney | |
@@ -322,9 +322,9 b'' | |||||
322 | f mammals/skunk mammals/skunk |
|
322 | f mammals/skunk mammals/skunk | |
323 | $ hg debugwalk -v -Ibeans mammals |
|
323 | $ hg debugwalk -v -Ibeans mammals | |
324 | * matcher: |
|
324 | * matcher: | |
325 |
<intersectionmatcher |
|
325 | <intersectionmatcher | |
326 |
<patternmatcher patterns='(?:mammals(?:/|$))'>, |
|
326 | m1=<patternmatcher patterns='(?:mammals(?:/|$))'>, | |
327 | <includematcher includes='(?:beans(?:/|$))'>> |
|
327 | m2=<includematcher includes='(?:beans(?:/|$))'>> | |
328 | $ hg debugwalk -v -Inon-existent |
|
328 | $ hg debugwalk -v -Inon-existent | |
329 | * matcher: |
|
329 | * matcher: | |
330 | <includematcher includes='(?:non\\-existent(?:/|$))'> |
|
330 | <includematcher includes='(?:non\\-existent(?:/|$))'> | |
@@ -334,21 +334,21 b'' | |||||
334 | f beans/black beans/black |
|
334 | f beans/black beans/black | |
335 | $ hg debugwalk -v -Ibeans beans/black |
|
335 | $ hg debugwalk -v -Ibeans beans/black | |
336 | * matcher: |
|
336 | * matcher: | |
337 |
<intersectionmatcher |
|
337 | <intersectionmatcher | |
338 |
<patternmatcher patterns='(?:beans\\/black(?:/|$))'>, |
|
338 | m1=<patternmatcher patterns='(?:beans\\/black(?:/|$))'>, | |
339 | <includematcher includes='(?:beans(?:/|$))'>> |
|
339 | m2=<includematcher includes='(?:beans(?:/|$))'>> | |
340 | f beans/black beans/black exact |
|
340 | f beans/black beans/black exact | |
341 | $ hg debugwalk -v -Ibeans/black beans |
|
341 | $ hg debugwalk -v -Ibeans/black beans | |
342 | * matcher: |
|
342 | * matcher: | |
343 |
<intersectionmatcher |
|
343 | <intersectionmatcher | |
344 |
<patternmatcher patterns='(?:beans(?:/|$))'>, |
|
344 | m1=<patternmatcher patterns='(?:beans(?:/|$))'>, | |
345 | <includematcher includes='(?:beans\\/black(?:/|$))'>> |
|
345 | m2=<includematcher includes='(?:beans\\/black(?:/|$))'>> | |
346 | f beans/black beans/black |
|
346 | f beans/black beans/black | |
347 | $ hg debugwalk -v -Xbeans/black beans |
|
347 | $ hg debugwalk -v -Xbeans/black beans | |
348 | * matcher: |
|
348 | * matcher: | |
349 |
<differencematcher |
|
349 | <differencematcher | |
350 |
<patternmatcher patterns='(?:beans(?:/|$))'>, |
|
350 | m1=<patternmatcher patterns='(?:beans(?:/|$))'>, | |
351 | <includematcher includes='(?:beans\\/black(?:/|$))'>> |
|
351 | m2=<includematcher includes='(?:beans\\/black(?:/|$))'>> | |
352 | f beans/borlotti beans/borlotti |
|
352 | f beans/borlotti beans/borlotti | |
353 | f beans/kidney beans/kidney |
|
353 | f beans/kidney beans/kidney | |
354 | f beans/navy beans/navy |
|
354 | f beans/navy beans/navy | |
@@ -356,9 +356,9 b'' | |||||
356 | f beans/turtle beans/turtle |
|
356 | f beans/turtle beans/turtle | |
357 | $ hg debugwalk -v -Xbeans/black -Ibeans |
|
357 | $ hg debugwalk -v -Xbeans/black -Ibeans | |
358 | * matcher: |
|
358 | * matcher: | |
359 |
<differencematcher |
|
359 | <differencematcher | |
360 |
<includematcher includes='(?:beans(?:/|$))'>, |
|
360 | m1=<includematcher includes='(?:beans(?:/|$))'>, | |
361 | <includematcher includes='(?:beans\\/black(?:/|$))'>> |
|
361 | m2=<includematcher includes='(?:beans\\/black(?:/|$))'>> | |
362 | f beans/borlotti beans/borlotti |
|
362 | f beans/borlotti beans/borlotti | |
363 | f beans/kidney beans/kidney |
|
363 | f beans/kidney beans/kidney | |
364 | f beans/navy beans/navy |
|
364 | f beans/navy beans/navy | |
@@ -366,24 +366,24 b'' | |||||
366 | f beans/turtle beans/turtle |
|
366 | f beans/turtle beans/turtle | |
367 | $ hg debugwalk -v -Xbeans/black beans/black |
|
367 | $ hg debugwalk -v -Xbeans/black beans/black | |
368 | * matcher: |
|
368 | * matcher: | |
369 |
<differencematcher |
|
369 | <differencematcher | |
370 |
<patternmatcher patterns='(?:beans\\/black(?:/|$))'>, |
|
370 | m1=<patternmatcher patterns='(?:beans\\/black(?:/|$))'>, | |
371 | <includematcher includes='(?:beans\\/black(?:/|$))'>> |
|
371 | m2=<includematcher includes='(?:beans\\/black(?:/|$))'>> | |
372 | $ hg debugwalk -v -Xbeans/black -Ibeans/black |
|
372 | $ hg debugwalk -v -Xbeans/black -Ibeans/black | |
373 | * matcher: |
|
373 | * matcher: | |
374 |
<differencematcher |
|
374 | <differencematcher | |
375 |
<includematcher includes='(?:beans\\/black(?:/|$))'>, |
|
375 | m1=<includematcher includes='(?:beans\\/black(?:/|$))'>, | |
376 | <includematcher includes='(?:beans\\/black(?:/|$))'>> |
|
376 | m2=<includematcher includes='(?:beans\\/black(?:/|$))'>> | |
377 | $ hg debugwalk -v -Xbeans beans/black |
|
377 | $ hg debugwalk -v -Xbeans beans/black | |
378 | * matcher: |
|
378 | * matcher: | |
379 |
<differencematcher |
|
379 | <differencematcher | |
380 |
<patternmatcher patterns='(?:beans\\/black(?:/|$))'>, |
|
380 | m1=<patternmatcher patterns='(?:beans\\/black(?:/|$))'>, | |
381 | <includematcher includes='(?:beans(?:/|$))'>> |
|
381 | m2=<includematcher includes='(?:beans(?:/|$))'>> | |
382 | $ hg debugwalk -v -Xbeans -Ibeans/black |
|
382 | $ hg debugwalk -v -Xbeans -Ibeans/black | |
383 | * matcher: |
|
383 | * matcher: | |
384 |
<differencematcher |
|
384 | <differencematcher | |
385 |
<includematcher includes='(?:beans\\/black(?:/|$))'>, |
|
385 | m1=<includematcher includes='(?:beans\\/black(?:/|$))'>, | |
386 | <includematcher includes='(?:beans(?:/|$))'>> |
|
386 | m2=<includematcher includes='(?:beans(?:/|$))'>> | |
387 | $ hg debugwalk -v 'glob:mammals/../beans/b*' |
|
387 | $ hg debugwalk -v 'glob:mammals/../beans/b*' | |
388 | * matcher: |
|
388 | * matcher: | |
389 | <patternmatcher patterns='(?:beans\\/b[^/]*$)'> |
|
389 | <patternmatcher patterns='(?:beans\\/b[^/]*$)'> | |
@@ -391,9 +391,9 b'' | |||||
391 | f beans/borlotti beans/borlotti |
|
391 | f beans/borlotti beans/borlotti | |
392 | $ hg debugwalk -v '-X*/Procyonidae' mammals |
|
392 | $ hg debugwalk -v '-X*/Procyonidae' mammals | |
393 | * matcher: |
|
393 | * matcher: | |
394 |
<differencematcher |
|
394 | <differencematcher | |
395 |
<patternmatcher patterns='(?:mammals(?:/|$))'>, |
|
395 | m1=<patternmatcher patterns='(?:mammals(?:/|$))'>, | |
396 | <includematcher includes='(?:[^/]*\\/Procyonidae(?:/|$))'>> |
|
396 | m2=<includematcher includes='(?:[^/]*\\/Procyonidae(?:/|$))'>> | |
397 | f mammals/skunk mammals/skunk |
|
397 | f mammals/skunk mammals/skunk | |
398 | $ hg debugwalk -v path:mammals |
|
398 | $ hg debugwalk -v path:mammals | |
399 | * matcher: |
|
399 | * matcher: | |
@@ -425,24 +425,24 b' Test explicit paths and excludes:' | |||||
425 |
|
425 | |||
426 | $ hg debugwalk -v fennel -X fennel |
|
426 | $ hg debugwalk -v fennel -X fennel | |
427 | * matcher: |
|
427 | * matcher: | |
428 |
<differencematcher |
|
428 | <differencematcher | |
429 |
<patternmatcher patterns='(?:fennel(?:/|$))'>, |
|
429 | m1=<patternmatcher patterns='(?:fennel(?:/|$))'>, | |
430 | <includematcher includes='(?:fennel(?:/|$))'>> |
|
430 | m2=<includematcher includes='(?:fennel(?:/|$))'>> | |
431 | $ hg debugwalk -v fennel -X 'f*' |
|
431 | $ hg debugwalk -v fennel -X 'f*' | |
432 | * matcher: |
|
432 | * matcher: | |
433 |
<differencematcher |
|
433 | <differencematcher | |
434 |
<patternmatcher patterns='(?:fennel(?:/|$))'>, |
|
434 | m1=<patternmatcher patterns='(?:fennel(?:/|$))'>, | |
435 | <includematcher includes='(?:f[^/]*(?:/|$))'>> |
|
435 | m2=<includematcher includes='(?:f[^/]*(?:/|$))'>> | |
436 | $ hg debugwalk -v beans/black -X 'path:beans' |
|
436 | $ hg debugwalk -v beans/black -X 'path:beans' | |
437 | * matcher: |
|
437 | * matcher: | |
438 |
<differencematcher |
|
438 | <differencematcher | |
439 |
<patternmatcher patterns='(?:beans\\/black(?:/|$))'>, |
|
439 | m1=<patternmatcher patterns='(?:beans\\/black(?:/|$))'>, | |
440 | <includematcher includes='(?:beans(?:/|$))'>> |
|
440 | m2=<includematcher includes='(?:beans(?:/|$))'>> | |
441 | $ hg debugwalk -v -I 'path:beans/black' -X 'path:beans' |
|
441 | $ hg debugwalk -v -I 'path:beans/black' -X 'path:beans' | |
442 | * matcher: |
|
442 | * matcher: | |
443 |
<differencematcher |
|
443 | <differencematcher | |
444 |
<includematcher includes='(?:beans\\/black(?:/|$))'>, |
|
444 | m1=<includematcher includes='(?:beans\\/black(?:/|$))'>, | |
445 | <includematcher includes='(?:beans(?:/|$))'>> |
|
445 | m2=<includematcher includes='(?:beans(?:/|$))'>> | |
446 |
|
446 | |||
447 | Test absolute paths: |
|
447 | Test absolute paths: | |
448 |
|
448 |
General Comments 0
You need to be logged in to leave comments.
Login now