# HG changeset patch # User Georges Racinet # Date 2019-01-14 17:52:01 # Node ID 2a8782cc2e16dbff1557ffa1701d56f05a700798 # Parent 4856c9b8cbaf79728b4a59670cbe6538b07ce737 discovery: using the new basesheads() Our ultimate goal is to switch eventually to a Rust implementation, but this move actually seems to increase the performance in a pure Python build. What follows is a quick measurement done on PyPy on repos prepared with `contrib/discovery-helper.sh 50 100`. Before: ! wall 0.894384 comb 0.890000 user 0.890000 sys 0.000000 (best of 11) ! wall 0.971199 comb 0.970000 user 0.950000 sys 0.020000 (max of 11) ! wall 0.927993 comb 0.925455 user 0.919091 sys 0.006364 (avg of 11) ! wall 0.921619 comb 0.920000 user 0.910000 sys 0.010000 (median of 11) After: ! wall 0.614278 comb 0.610000 user 0.610000 sys 0.000000 (best of 14) ! wall 0.789459 comb 0.790000 user 0.770000 sys 0.020000 (max of 14) ! wall 0.722765 comb 0.720000 user 0.715714 sys 0.004286 (avg of 14) ! wall 0.734448 comb 0.720000 user 0.720000 sys 0.000000 (median of 14) Differential Revision: https://phab.mercurial-scm.org/D5583 diff --git a/mercurial/setdiscovery.py b/mercurial/setdiscovery.py --- a/mercurial/setdiscovery.py +++ b/mercurial/setdiscovery.py @@ -229,9 +229,7 @@ class partialdiscovery(object): """the heads of the known common set""" # heads(common) == heads(common.bases) since common represents # common.bases and all its ancestors - # The presence of nullrev will confuse heads(). So filter it out. - return set(self._repo.revs('heads(%ld)', - self._common.bases - {nullrev})) + return self._common.basesheads() def findcommonheads(ui, local, remote, initialsamplesize=100,