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