changeset 39173:56279660d264

setdiscovery: use revsets for computing a subset's heads and roots revlogdag.headsetofconnecteds() obtains the set of DAG heads in a given set of revs. revlogdag.inverse() inverts the DAG order and makes headsetofconnecteds() obtain the DAG roots in a given subset. Both of these can be expressed with a revset. Like other patches in this series, revlogdag uses revlog.index and thus doesn't take filtering into account. Revsets do. So there is a chance for regressions with this change. But no tests fail. And I think this code should take filtering into account since hidden changesets shouldn't factor into discovery (unless operating on the hidden repository). Differential Revision: https://phab.mercurial-scm.org/D4321
author Gregory Szorc <gregory.szorc@gmail.com>
date Fri, 17 Aug 2018 18:05:36 +0000
parents 8973fc62bfff
children 71d83b315778
files mercurial/setdiscovery.py
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/setdiscovery.py	Fri Aug 17 17:59:16 2018 +0000
+++ b/mercurial/setdiscovery.py	Fri Aug 17 18:05:36 2018 +0000
@@ -114,11 +114,11 @@
     sample = set(repo.revs('heads(%ld)', revs))
 
     # update from heads
-    _updatesample(dag, revs, dag.headsetofconnecteds(revs), sample)
+    revsheads = set(repo.revs('heads(%ld)', revs))
+    _updatesample(dag, revs, revsheads, sample)
     # update from roots
-    inverteddag = dag.inverse()
-    _updatesample(inverteddag, revs, inverteddag.headsetofconnecteds(revs),
-                  sample)
+    revsroots = set(repo.revs('roots(%ld)', revs))
+    _updatesample(dag.inverse(), revs, revsroots, sample)
     assert sample
     sample = _limitsample(sample, size)
     if len(sample) < size: