This is an archive of the discontinued Mercurial Phabricator instance.

revset: use phasecache.getrevset to calculate public()
ClosedPublic

Authored by quark on Dec 8 2017, 5:47 PM.

Details

Summary

Other revsets like secret(), draft(), _nonpublic() are using
phasescache.getrevset already. The latter is more efficient after D1606.
So let's migrate the public() revset function too.

Tested using:

$ hg debugshell --hidden --cwd hg-committed`
In [1]: %timeit len(repo.revs('public()'))
  • Before D1606: 10 loops, best of 3: 22.5 ms per loop
  • Before this change, after D1606: 10 loops, best of 3: 28.6 ms per loop
  • After this change: 10 loops, best of 3: 20.2 ms per loop

Therefore public() revset becomes even slightly faster after the data
structure change by D1606. A similar performance win could also be observed
on a large repo.

A side effect is phasecache.getrevset needs to take a subset parameter.
That was added with a default value so it won't cause BC issues.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

quark created this revision.Dec 8 2017, 5:47 PM
yuja accepted this revision.Dec 8 2017, 8:38 PM
This revision is now accepted and ready to land.Dec 8 2017, 8:38 PM
This revision was automatically updated to reflect the committed changes.