add a topic for a whole branch

Steve Fink sphink at gmail.com
Mon Oct 5 18:25:53 UTC 2020


On 9/29/20 11:57 PM, Uwe Brauer wrote:
>>>> "SF" == Steve Fink <sphink at gmail.com> writes:
>
>>   [revsetalias]
>>   my($1) = not public() and $1
>>   topobranch($1) = descendants(my(ancestors($1)))
>> though I do not like the name 'topobranch'.
>
> I am just wondering I did:
>
> [alias]
> addtopicbranch =  topic -r 'descendants(not public() and ancestors(.))' $1
>
> What is the difference between these two approaches? 
>
> (Well I have to put -r since it is a general alias, you don't, but yours
> seem more recursive)

How so? They seem identical to me -- doesn't mine expand to the same
thing as yours? (Ignoring the difference between [revsetalias] and [alias].)

Note that if it is implemented naively, this basic
descendants(ancestors(.)) thing is pretty awful -- O(n^2) if I'm not
mistaken -- but I timed it against the nearly equivalent
descendants(first(ancestors(.))) and it came out the same speed on my
simple test. So perhaps it's optimized to the same thing. (And I dislike
using first()/last() because I can never figure out at a glance what
order the underlying thing is going to use without experimenting. Though
I think that's just a mental block -- now that I've written that, it
seems obvious that it's going to be based on the changeset number.)



More information about the Mercurial mailing list