revset: add helper function to get revset parse tree depth
Will be used to determine if a hgweb search query actually uses
any revset syntax.
--- a/mercurial/revset.py Sat Sep 07 00:59:24 2013 -0700
+++ b/mercurial/revset.py Fri Aug 09 22:52:58 2013 +0400
@@ -1935,5 +1935,11 @@
output = '\n'.join((' '*l + s) for l, s in lines)
return output
+def depth(tree):
+ if isinstance(tree, tuple):
+ return max(map(depth, tree)) + 1
+ else:
+ return 0
+
# tell hggettext to extract docstrings from these functions:
i18nfunctions = symbols.values()