comparison mercurial/revset.py @ 19719:2f9d5c5256ea

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.
author Alexander Plavin <alexander@plav.in>
date Fri, 09 Aug 2013 22:52:58 +0400
parents 26ddce1a2a55
children f0b992a9be9c
comparison
equal deleted inserted replaced
19718:d69e06724b96 19719:2f9d5c5256ea
1933 lines = [] 1933 lines = []
1934 _prettyformat(tree, 0, lines) 1934 _prettyformat(tree, 0, lines)
1935 output = '\n'.join((' '*l + s) for l, s in lines) 1935 output = '\n'.join((' '*l + s) for l, s in lines)
1936 return output 1936 return output
1937 1937
1938 def depth(tree):
1939 if isinstance(tree, tuple):
1940 return max(map(depth, tree)) + 1
1941 else:
1942 return 0
1943
1938 # tell hggettext to extract docstrings from these functions: 1944 # tell hggettext to extract docstrings from these functions:
1939 i18nfunctions = symbols.values() 1945 i18nfunctions = symbols.values()