question about revset usage

Faheem Mitha faheem at faheem.info
Mon Sep 22 21:57:24 UTC 2014


On Mon, 22 Sep 2014, Mads Kiilerich wrote:

> On 09/21/2014 10:45 AM, Faheem Mitha wrote:
>> If I use revsets as follows:
>> 
>> faheem at orwell:/usr/local/src/mercurial/hg$  hg log -r 
>> 'author(mpm at selenic.com)'
>> 
>> The order of the csets is reversed - the oldest csets are at the top, 
>> unlike the normal result of `hg log` where the newest csets are at the top. 
>> I.e.
>> 
>> faheem at orwell:/usr/local/src/mercurial/hg$  hg log -l1 -r 
>> 'author(mpm at selenic.com)'
>> changeset:   0:9117c6561b0b
>> user:        mpm at selenic.com
>> date:        Tue May 03 13:16:10 2005 -0800
>> summary:     Add back links from file revisions to changeset revisions
>> 
>> I rarely use revsets, but in any case, I've not noticed this behavior 
>> before, nor could I find any documentation about it. I also can't think of 
>> any good reason for this behavior. If this is correct behavior, and if I am 
>> not missing something obvious, I suggest it be documented somewhere.
>
> The unsorted order of revsets is not documented and can thus be considered 
> undefined and can thus not be wrong. If you want a special order, use sort().
>
> One reason to have it that way is that different predicates most efficiently 
> will yield results in different orders. For example, everything involving 
> unpacking of revlogs is most efficiently done with increasing rev numbers, 
> while ancestors obviously yield descreasing rev numbers.
>
> I agree that it would be nice if everything used the same order (decreasing!) 
> unless another sorting was requested but I am afraid that it would break a 
> lot of existing revsets out there so it might not be feasible to change it 
> even though it is undocumented and somewhat surprising behaviour. Documenting 
> it beyond the fact that it is undefined might not be feasible.

> (In Kallithea we take care to always show revisions in the "right" order ... 
> also because graphs become very confusing if shown upside down.)

Thank you for the clarification. I think this is worth documenting that 
the order of csets is undefined. It appears to be currently undocumented. 
What do you think?

                                                     Regards, Faheem Mitha



More information about the Mercurial mailing list