Mercurial > public > mercurial-scm > hg-stable
diff mercurial/revset.py @ 29909:371c2a39eead
revset: make analyze() a separate step from optimize()
This will allow us to evaluate unoptimized tree and compare the result with
optimized one.
The private _analyze() function isn't renamed since I'll add more parameters
to it.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 21 Aug 2016 11:29:57 +0900 |
parents | e4b4168a4f1c |
children | 41491cf936f2 |
line wrap: on
line diff
--- a/mercurial/revset.py Sun Aug 07 14:35:03 2016 +0900 +++ b/mercurial/revset.py Sun Aug 21 11:29:57 2016 +0900 @@ -2343,12 +2343,6 @@ return (op,) + tuple(_fixops(y) for y in x[1:]) def _analyze(x): - """Transform raw parsed tree to evaluatable tree which can be fed to - optimize() or getset() - - All pseudo operations should be mapped to real operations or functions - defined in methods or symbols table respectively. - """ if x is None: return x @@ -2399,11 +2393,16 @@ return (op, x[1], _analyze(x[2])) raise ValueError('invalid operator %r' % op) +def analyze(x): + """Transform raw parsed tree to evaluatable tree which can be fed to + optimize() or getset() + + All pseudo operations should be mapped to real operations or functions + defined in methods or symbols table respectively. + """ + return _analyze(x) + def _optimize(x, small): - """Optimize evaluatable tree - - All pseudo operations should be transformed beforehand. - """ if x is None: return 0, x @@ -2505,7 +2504,10 @@ raise ValueError('invalid operator %r' % op) def optimize(tree): - tree = _analyze(tree) + """Optimize evaluatable tree + + All pseudo operations should be transformed beforehand. + """ _weight, newtree = _optimize(tree, small=True) return newtree @@ -2619,6 +2621,7 @@ if ui: tree = expandaliases(ui, tree, showwarning=ui.warn) tree = foldconcat(tree) + tree = analyze(tree) tree = optimize(tree) posttreebuilthook(tree, repo) def mfunc(repo, subset=None):