D441: revset: optimize "draft() & ::x" pattern

yuja (Yuya Nishihara) phabricator at mercurial-scm.org
Sun Sep 3 10:08:40 EDT 2017


yuja accepted this revision.
yuja added a comment.
This revision is now accepted and ready to land.


  Queued, thanks. I've removed `_()` because `_phaseandancestors()` is an internal function.

INLINE COMMENTS

> revset.py:1607
> +    if phasename == 'draft': # need to remove secret changesets
> +        revs = revs.filter(lambda r: getphase(repo, r) == draft)
> +    return subset & revs

`revs & phasecache.getrevset(repo, [phasename])` might be
slightly faster, but I don't think it would make any noticeable difference.

> revsetlang.py:373
> +        # (draft/secret/_notpublic() & ::x) have a fast path
> +        m = _match('_() & ancestors(_)', ('and', ta, tb))
> +        if m and getsymbol(m[1]) in {'draft', 'secret', '_notpublic'}:

Perhaps `::x & phasename()` can be optimized, too.

REPOSITORY
  rHG Mercurial

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

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


More information about the Mercurial-devel mailing list