[PATCH 1 of 4 V2] revset: add helper function to get tree depth
Alexander Plavin
alexander at plav.in
Mon Aug 12 13:03:45 CDT 2013
12.08.2013, 18:29, "Augie Fackler" <raf at durin42.com>:
> On Fri, Aug 09, 2013 at 10:54:55PM +0400, Alexander Plavin wrote:
>
>> # HG changeset patch
>> # User Alexander Plavin <alexander at plav.in>
>> # Date 1376074378 -14400
>> # Fri Aug 09 22:52:58 2013 +0400
>> # Node ID 10862e95f769e7555ee54c0647595d508d5672ef
>> # Parent da2209742e39683a5a42672e69133b1a20898973
>> revset: add helper function to get tree depth
>
> I might mention that it's the depth of the parse tree for the revset -
> that wasn't immediately obvious to me.
Ok, will add this. But what else could it possibly mean? :)
>
>> diff -r da2209742e39 -r 10862e95f769 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()
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel at selenic.com
>> http://selenic.com/mailman/listinfo/mercurial-devel
More information about the Mercurial-devel
mailing list