3517 """parse and apply a revision specification |
3517 """parse and apply a revision specification |
3518 |
3518 |
3519 Use --verbose to print the parsed tree before and after aliases |
3519 Use --verbose to print the parsed tree before and after aliases |
3520 expansion. |
3520 expansion. |
3521 """ |
3521 """ |
|
3522 stages = [ |
|
3523 ('parsed', lambda tree: tree), |
|
3524 ('expanded', lambda tree: revset.expandaliases(ui, tree)), |
|
3525 ('concatenated', revset.foldconcat), |
|
3526 ('analyzed', revset.analyze), |
|
3527 ('optimized', revset.optimize), |
|
3528 ] |
|
3529 |
|
3530 showalways = set(['parsed']) |
|
3531 showchanged = set(['expanded', 'concatenated']) |
|
3532 if opts['optimize']: |
|
3533 showalways.add('optimized') |
|
3534 |
|
3535 printedtree = None |
3522 tree = revset.parse(expr, lookup=repo.__contains__) |
3536 tree = revset.parse(expr, lookup=repo.__contains__) |
3523 ui.note(revset.prettyformat(tree), "\n") |
3537 for n, f in stages: |
3524 newtree = revset.expandaliases(ui, tree) |
3538 tree = f(tree) |
3525 if newtree != tree: |
3539 if n in showalways or (n in showchanged and tree != printedtree): |
3526 ui.note(("* expanded:\n"), revset.prettyformat(newtree), "\n") |
3540 if n != 'parsed': |
3527 tree = newtree |
3541 ui.note(("* %s:\n") % n) |
3528 newtree = revset.foldconcat(tree) |
3542 ui.note(revset.prettyformat(tree), "\n") |
3529 if newtree != tree: |
3543 printedtree = tree |
3530 ui.note(("* concatenated:\n"), revset.prettyformat(newtree), "\n") |
|
3531 if opts["optimize"]: |
|
3532 newtree = revset.analyze(newtree) |
|
3533 optimizedtree = revset.optimize(newtree) |
|
3534 ui.note(("* optimized:\n"), |
|
3535 revset.prettyformat(optimizedtree), "\n") |
|
3536 |
3544 |
3537 func = revset.match(ui, expr, repo) |
3545 func = revset.match(ui, expr, repo) |
3538 revs = func(repo) |
3546 revs = func(repo) |
3539 if ui.verbose: |
3547 if ui.verbose: |
3540 ui.note(("* set:\n"), revset.prettyformatset(revs), "\n") |
3548 ui.note(("* set:\n"), revset.prettyformatset(revs), "\n") |