mercurial/setdiscovery.py
changeset 41116 9815d3337f9b
parent 41115 3023bc4b3da0
child 41162 cc1f545c4075
--- a/mercurial/setdiscovery.py	Fri Dec 28 03:14:34 2018 +0100
+++ b/mercurial/setdiscovery.py	Fri Dec 28 03:28:02 2018 +0100
@@ -182,6 +182,13 @@
         """return True is we have any clue about the remote state"""
         return self._common.hasbases()
 
+    def commonheads(self):
+        """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}))
 
 def findcommonheads(ui, local, remote,
                     initialsamplesize=100,
@@ -311,10 +318,7 @@
             disco.addcommons(commoninsample)
             disco._common.removeancestorsfrom(undecided)
 
-    # 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.
-    result = set(local.revs('heads(%ld)', disco._common.bases - {nullrev}))
+    result = disco.commonheads()
     elapsed = util.timer() - start
     progress.complete()
     ui.debug("%d total queries in %.4fs\n" % (roundtrips, elapsed))