D451: revset: remove order information from tree

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Sun Aug 27 10:48:48 EDT 2017


yuja added a comment.


  > It seems `_optimize()` has more bugs
  
  Perhaps we can eliminate `preserveorder` flag from `_optimize()` at all.
  `flipand` can always be inserted since `and(x, y)` is exactly the same as
  `flipand(x, y)` if `order != defineorder`. For `or`, we could
  
  - backout https://phab.mercurial-scm.org/rHGc63cb2d10d6d5dc823853300f14fa9638bccfb68 assuming the optimization wouldn't be that useful
  - or add an internal method to select define/anyorder tree at runtime, e.g. `(switch-by-order (or original-tree) (or sorted-tree))`
  
  One of the drawback of the current patch is we have to resolve the order
  constraint twice, at parsing phase and evaluation phase. That's probably why
  I decided to embed the flag to parsed tree, though I don't remember it. :-)

INLINE COMMENTS

> revset.py:892
> +def _flipand(repo, subset, args, order):
> +    """Equivalent to ``y and x``, but faster when x is small"""
> +    x, y = getargs(args, 2, 2, _("missing argument"))

Nit: this could be an internal method (= operator) like `difference`
since we don't need to embed it in revset expression.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D451

To: quark, #hg-reviewers
Cc: martinvonz, yuja, mercurial-devel


More information about the Mercurial-devel mailing list