[PATCH 1 of 6 V3] revset: add helper function to get revset parse tree depth
Alexander Plavin
alexander at plav.in
Thu Aug 22 15:11:12 UTC 2013
# HG changeset patch
# User Alexander Plavin <alexander at plav.in>
# Date 1376074378 -14400
# Fri Aug 09 22:52:58 2013 +0400
# Node ID f32bf1774cc3e6cd7ee99a7be2724daa23223a98
# Parent 04c91751cbf8abc1f3ea56c67ca4988e0e8e61a5
revset: add helper function to get revset parse tree depth
diff -r 04c91751cbf8 -r f32bf1774cc3 mercurial/revset.py
--- a/mercurial/revset.py Fri Jul 19 02:09:13 2013 +0400
+++ b/mercurial/revset.py Fri Aug 09 22:52:58 2013 +0400
@@ -1972,5 +1972,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()
More information about the Mercurial-devel
mailing list