[PATCH 2 of 5] revset: insert _reorder to fix ordering of inner OR and some functions (BC)

Yuya Nishihara yuya at tcha.org
Fri Jun 3 09:35:53 EDT 2016


On Thu, 2 Jun 2016 14:17:36 -0700, Martin von Zweigbergk wrote:
> >    $ log 'matching(1 or 2 or 3) and (2 or 3 or 1)'
> > +  1
> >    2
> >    3
> > -  1  
> 
> This makes sense to me, but I tried backing out the code changes in
> 592e0beee8b0 (revset: make matching() preserve input revision order,
> 2012-05-09) and it turns out the order was "1 2 3" before that change.
> There is no more description than what's on the subject line. It seems
> backwards to me; the input order was preserved before the change, but
> not after. Maybe someone here remembers what the reasoning was?

Good catch. Before, matching() always did sort the result, which was wrong
and fixed by 592e0beee8b0. The test added by 592e0beee8b0 isn't perfect, but
it was working because matching() is slow function and therefore the expression
is rewritten as '(2 or 3 or 1) and matching(1 or 2 or 3)'.

% hg debugrevspec -v --optimize 'matching(1 or 2 or 3) and (2 or 3 or 1)'
(and
  (func
    ('symbol', 'matching')
    (or
      ('symbol', '1')
      ('symbol', '2')
      ('symbol', '3')))
  (group
    (or
      ('symbol', '2')
      ('symbol', '3')
      ('symbol', '1'))))
* optimized:
(and
  (func
    ('symbol', '_list')
    ('string', '2\x003\x001'))
  (func
    ('symbol', 'matching')
    (func
      ('symbol', '_list')
      ('string', '1\x002\x003'))))

I have to fix the test of matching() first. V2 is coming...


More information about the Mercurial-devel mailing list