Show More
@@ -3511,13 +3511,16 b' def debugrevlog(ui, repo, file_=None, **' | |||
|
3511 | 3511 | numdeltas)) |
|
3512 | 3512 | |
|
3513 | 3513 | @command('debugrevspec', |
|
3514 |
[('', 'optimize', None, _('print parsed tree after optimizing')) |
|
|
3514 | [('', 'optimize', None, _('print parsed tree after optimizing')), | |
|
3515 | ('p', 'show-stage', [], | |
|
3516 | _('print parsed tree at the given stage'), _('NAME')), | |
|
3517 | ], | |
|
3515 | 3518 | ('REVSPEC')) |
|
3516 | 3519 | def debugrevspec(ui, repo, expr, **opts): |
|
3517 | 3520 | """parse and apply a revision specification |
|
3518 | 3521 | |
|
3519 |
Use -- |
|
|
3520 | expansion. | |
|
3522 | Use -p/--show-stage option to print the parsed tree at the given stages. | |
|
3523 | Use -p all to print tree at every stage. | |
|
3521 | 3524 | """ |
|
3522 | 3525 | stages = [ |
|
3523 | 3526 | ('parsed', lambda tree: tree), |
@@ -3526,20 +3529,34 b' def debugrevspec(ui, repo, expr, **opts)' | |||
|
3526 | 3529 | ('analyzed', revset.analyze), |
|
3527 | 3530 | ('optimized', revset.optimize), |
|
3528 | 3531 | ] |
|
3529 | ||
|
3530 | showalways = set(['parsed']) | |
|
3531 | showchanged = set(['expanded', 'concatenated']) | |
|
3532 | stagenames = set(n for n, f in stages) | |
|
3533 | ||
|
3534 | showalways = set() | |
|
3535 | showchanged = set() | |
|
3536 | if ui.verbose and not opts['show_stage']: | |
|
3537 | # show parsed tree by --verbose (deprecated) | |
|
3538 | showalways.add('parsed') | |
|
3539 | showchanged.update(['expanded', 'concatenated']) | |
|
3532 | 3540 | if opts['optimize']: |
|
3533 | 3541 | showalways.add('optimized') |
|
3542 | if opts['show_stage'] and opts['optimize']: | |
|
3543 | raise error.Abort(_('cannot use --optimize with --show-stage')) | |
|
3544 | if opts['show_stage'] == ['all']: | |
|
3545 | showalways.update(stagenames) | |
|
3546 | else: | |
|
3547 | for n in opts['show_stage']: | |
|
3548 | if n not in stagenames: | |
|
3549 | raise error.Abort(_('invalid stage name: %s') % n) | |
|
3550 | showalways.update(opts['show_stage']) | |
|
3534 | 3551 | |
|
3535 | 3552 | printedtree = None |
|
3536 | 3553 | tree = revset.parse(expr, lookup=repo.__contains__) |
|
3537 | 3554 | for n, f in stages: |
|
3538 | 3555 | tree = f(tree) |
|
3539 | 3556 | if n in showalways or (n in showchanged and tree != printedtree): |
|
3540 | if n != 'parsed': | |
|
3541 |
ui. |
|
|
3542 |
ui. |
|
|
3557 | if opts['show_stage'] or n != 'parsed': | |
|
3558 | ui.write(("* %s:\n") % n) | |
|
3559 | ui.write(revset.prettyformat(tree), "\n") | |
|
3543 | 3560 | printedtree = tree |
|
3544 | 3561 | |
|
3545 | 3562 | func = revset.match(ui, expr, repo) |
@@ -269,7 +269,7 b' Show all commands + options' | |||
|
269 | 269 | debugrebuildfncache: |
|
270 | 270 | debugrename: rev |
|
271 | 271 | debugrevlog: changelog, manifest, dir, dump |
|
272 | debugrevspec: optimize | |
|
272 | debugrevspec: optimize, show-stage | |
|
273 | 273 | debugsetparents: |
|
274 | 274 | debugsub: rev |
|
275 | 275 | debugsuccessorssets: |
@@ -489,6 +489,56 b' keyword arguments' | |||
|
489 | 489 | hg: parse error: can't use a key-value pair in this context |
|
490 | 490 | [255] |
|
491 | 491 | |
|
492 | parsed tree at stages: | |
|
493 | ||
|
494 | $ hg debugrevspec -p all '()' | |
|
495 | * parsed: | |
|
496 | (group | |
|
497 | None) | |
|
498 | * expanded: | |
|
499 | (group | |
|
500 | None) | |
|
501 | * concatenated: | |
|
502 | (group | |
|
503 | None) | |
|
504 | * analyzed: | |
|
505 | None | |
|
506 | * optimized: | |
|
507 | None | |
|
508 | hg: parse error: missing argument | |
|
509 | [255] | |
|
510 | ||
|
511 | $ hg debugrevspec -p parsed -p analyzed -p optimized '(0|1)-1' | |
|
512 | * parsed: | |
|
513 | (minus | |
|
514 | (group | |
|
515 | (or | |
|
516 | ('symbol', '0') | |
|
517 | ('symbol', '1'))) | |
|
518 | ('symbol', '1')) | |
|
519 | * analyzed: | |
|
520 | (and | |
|
521 | (or | |
|
522 | ('symbol', '0') | |
|
523 | ('symbol', '1')) | |
|
524 | (not | |
|
525 | ('symbol', '1'))) | |
|
526 | * optimized: | |
|
527 | (difference | |
|
528 | (func | |
|
529 | ('symbol', '_list') | |
|
530 | ('string', '0\x001')) | |
|
531 | ('symbol', '1')) | |
|
532 | 0 | |
|
533 | ||
|
534 | $ hg debugrevspec -p unknown '0' | |
|
535 | abort: invalid stage name: unknown | |
|
536 | [255] | |
|
537 | ||
|
538 | $ hg debugrevspec -p all --optimize '0' | |
|
539 | abort: cannot use --optimize with --show-stage | |
|
540 | [255] | |
|
541 | ||
|
492 | 542 | Test that symbols only get parsed as functions if there's an opening |
|
493 | 543 | parenthesis. |
|
494 | 544 |
General Comments 0
You need to be logged in to leave comments.
Login now