changeset 24518:dd5e56f08d13

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.
author Laurent Charignon <lcharignon@fb.com>
date Tue, 24 Mar 2015 14:24:55 -0700
parents c2c1ce5e6db1
children de3acfabaddc
files mercurial/revset.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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)