mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 23:38:50 +03:00
commands.debugrevspec: add an option to print the optimized expression tree
This will be used in an upcoming patch to test that the optimizer works.
This commit is contained in:
parent
2c8f3e258b
commit
bf7fddd84c
@ -2548,8 +2548,10 @@ def debugrevlog(ui, repo, file_=None, **opts):
|
||||
ui.write(('deltas against other : ') + fmt % pcfmt(numother,
|
||||
numdeltas))
|
||||
|
||||
@command('debugrevspec', [], ('REVSPEC'))
|
||||
def debugrevspec(ui, repo, expr):
|
||||
@command('debugrevspec',
|
||||
[('', 'optimize', None, _('print parsed tree after optimizing'))],
|
||||
('REVSPEC'))
|
||||
def debugrevspec(ui, repo, expr, **opts):
|
||||
"""parse and apply a revision specification
|
||||
|
||||
Use --verbose to print the parsed tree before and after aliases
|
||||
@ -2561,6 +2563,9 @@ def debugrevspec(ui, repo, expr):
|
||||
newtree = revset.findaliases(ui, tree)
|
||||
if newtree != tree:
|
||||
ui.note(revset.prettyformat(newtree), "\n")
|
||||
if opts["optimize"]:
|
||||
weight, optimizedtree = revset.optimize(newtree, True)
|
||||
ui.note("* optimized:\n", revset.prettyformat(optimizedtree), "\n")
|
||||
func = revset.match(ui, expr)
|
||||
for c in func(repo, revset.baseset(range(len(repo)))):
|
||||
ui.write("%s\n" % c)
|
||||
|
@ -250,7 +250,7 @@ Show all commands + options
|
||||
debugrebuilddirstate: rev
|
||||
debugrename: rev
|
||||
debugrevlog: changelog, manifest, dump
|
||||
debugrevspec:
|
||||
debugrevspec: optimize
|
||||
debugsetparents:
|
||||
debugsub: rev
|
||||
debugsuccessorssets:
|
||||
|
Loading…
Reference in New Issue
Block a user