revset: add hook after tree parsing
This will be useful to execute actions after the tree is parsed and
before the revset returns a match. Finding symbols in the parse tree
will later allow hashes of hidden revisions to work on the command
line without the --hidden flag.
--- a/mercurial/revset.py Mon Mar 30 14:58:42 2015 -0400
+++ b/mercurial/revset.py Tue Mar 24 14:24:55 2015 -0700
@@ -2493,6 +2493,10 @@
p = parser.parser(tokenize, elements)
return p.parse(spec, lookup=lookup)
+def posttreebuilthook(tree, repo):
+ # hook for extensions to execute code on the optimized tree
+ pass
+
def match(ui, spec, repo=None):
if not spec:
raise error.ParseError(_("empty query"))
@@ -2506,6 +2510,7 @@
tree = findaliases(ui, tree, showwarning=ui.warn)
tree = foldconcat(tree)
weight, tree = optimize(tree, True)
+ posttreebuilthook(tree, repo)
def mfunc(repo, subset=None):
if subset is None:
subset = fullreposet(repo)